Home  >  Article  >  Database  >  How to remove newline character in oracle

How to remove newline character in oracle

WBOY
WBOYOriginal
2022-05-24 15:31:4810582browse

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 表名;

or

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

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

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;

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;

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!

Statement:
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