Home > Database > Oracle > body text

How to remove newline character in oracle

WBOY
Release: 2022-05-24 15:31:48
Original
10583 people have browsed it

Method: 1. Use replace, the syntax is "replace(replace(column name,CHR(10),\'\'),chr(13),\'\')"; 2. Use translate, Syntax "translate(column name,chr(13)||chr(10),\',\')".

How to remove newline character in oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How to remove newline characters in oracle

Special symbols ascii definition: Both newline characters and carriage return characters need to be removed.

Line feed character chr(10)

Carriage return character chr(13)

The syntax is as follows:

select replace(replace(列名,CHR(10),\'\'),chr(13),\'\')  from 表名;
Copy after login

or

select translate(列名,chr(13)||chr(10),\',\') from 表名;
Copy after login

Extended knowledge:

Use repalce in nested form, please note that only one symbol can be submitted at a time, such as carriage return first and then line feed

    select REPLACE(gg, chr(10), '') from dual
Copy after login

Please pay attention to chr(13) | | chr (10) This type of combination is often used. Carriage return and line feed look better in notepad, so this situation should be considered.

    select translate(string,chr(13)||chr(10),',') from dual;
Copy after login

Symbol processing of large character objects

For symbol processing in the clob field, first to_char and then process it in the same way

SQL> select to_char(vcl),replace(to_char(vcl),chr(10),'[]') from test_1;
Copy after login

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to remove newline character in oracle. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template