If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > carriage return in DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jan 2008
Posts: 8
carriage return in DB2

Hi All,

what is the carriage return character in DB2 (i.e enter key -new line)
i was trying this char(13) but no luck...
please help me out....

SELECT 'first' || char(13) || 'second' FROM SYSIBM.SYSDUMMY1

i want the result set to be
first
second
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,721
The answer is: it depends. It depends on the code page of the client whether you will get the output you have shown.

However, you have 2 small issues:
(1) CHAR(13) returns a string with the number 13 encoded in it. You probably want to use the CHR() function instead.
(2) 13 is the ASCII character (so it only works if you have an ASCII client code page) for carriage return, i.e. the character that moves the cursor to the beginning of the line. If you want to move it to the beginning of the next line, you should use CHR(10).
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Jan 2008
Posts: 8
Hi,

i tried this... but no luck
SELECT 'FIRST' || CHR(10) || 'SECOND' FROM SYSIBM.SYSDUMMY1
error: [SQL0204] CHR in *LIBL type *N not found

i am using IBM i series operation navigator for sql queries...
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,721
You neglected to mention the platfrom you are using. I tried the statement on DB2 LUW and it is working fine.

Whether DB2 for iSeries supports something like CHR(), I do not know. Have you checked the manuals?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,734
I believe that iSeries uses EBCDIC (like z/OS).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On