Home > Software design >  Putting a newline character between the strings in Oracle
Putting a newline character between the strings in Oracle

Time:05-31

I have queries

select 'Hello' || chr(13) ||' world' as new from dual;
select 'Hello' || chr(10) ||' world' as new from dual;

both giving me result as Hello World, but I want to print it like,

Hello
World

Can I please get help with this? It is basically putting a newline character between the strings.

CodePudding user response:

It should work for you.

select 'Hello' || chr(13) || chr(10)||' world' from dual 

Chr(10) = line feed

Chr(13) = carriage return

CodePudding user response:

You can use a literal newline.

SELECT 'Hello
World!' FROM DUAL;
'HELLOWORLD!'
*************
Hello
World!

db<>fiddle here

  • Related