Home » SQL & PL/SQL » SQL & PL/SQL » Insert CR into line
Insert CR into line [message #307912] Thu, 20 March 2008 05:58 Go to next message
majstoru
Messages: 68
Registered: October 2006
Location: Serbia
Member
Hi,

I have table1 which contain 5 fileds txt01..05, and I need to write sql stateent which will select all 5 fileds one by one like

txt01 CR (new line)
txt02 CR
txt03 CR
txt04 CR
txt05

Thanks in advanced...
Re: Insert CR into line [message #307916 is a reply to message #307912] Thu, 20 March 2008 06:06 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is a classical pivot query.
Search for this word.

Regards
Michel
Re: Insert CR into line [message #307922 is a reply to message #307912] Thu, 20 March 2008 06:16 Go to previous messageGo to next message
majstoru
Messages: 68
Registered: October 2006
Location: Serbia
Member
Hi Michel,

It seems that I was descibed my problem bad. I have table a with 5 varchar fields and I need to write sql which will select key from that table and all 5 fileds into one filed where ewery filed represent one line under another delimited by CR (Enter).

For example: id = 1, field1 = 'oracle', field2 = 'rdbms', field3 = '10g'
and result will be:

id          some_text
            oracle
1           rdbms
            10g


I think that this is little closer explanation of my problem!

Thanks again!
Re: Insert CR into line [message #307926 is a reply to message #307922] Thu, 20 March 2008 06:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> select 'id' id,
  2  'first field'||'
  3  '||'second field'||'
  4  '||'third field' fields
  5  from dual;
ID FIELDS
-- ------------------------------------
id first field
   second field
   third field

1 row selected.

Regards
Michel
Re: Insert CR into line [message #307939 is a reply to message #307912] Thu, 20 March 2008 07:42 Go to previous message
majstoru
Messages: 68
Registered: October 2006
Location: Serbia
Member
Bingo

Thanks Michael...
Previous Topic: how to reduce the time for Package to execute
Next Topic: using, in the select-clause, a result calculated in the where-clause
Goto Forum:
  


Current Time: Sat Dec 10 16:53:31 CST 2016

Total time taken to generate the page: 0.09320 seconds