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 > Not able to execute Insert Query with concatenation operator

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-11, 06:57
dhwani dhwani is offline
Registered User
 
Join Date: Jan 2011
Posts: 1
Question Not able to execute Insert Query with concatenation operator

Hi,

I am trying to run following query in a DB2 database,

INSERT INTO &DATABASE..SLCT_DFN
VALUES(123,'','2010-1-1','2012-1-1',0,'Test',''
,
'This is a very long line. This is a very long line. This is a '||
'very long line. This is a very long line. This is a very long '||
'line. This is a very long line. This is a very long line. This'||
' is a very long line. This is a very long line.','TH','')

but not able to get any success. I have attached screenshot of the error i am getting.
Can some one help?

I am sorry i dont know from where to get the DB2 version and other stuff. I tried DB2LEVEL command but may be at wrong panel.
Attached Thumbnails
Not able to execute Insert Query with concatenation operator-41b636d97bb5d5e6.jpg   Not able to execute Insert Query with concatenation operator-3166389a362411e9.jpg  
Reply With Quote
  #2 (permalink)  
Old 01-18-11, 09:46
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
R you trying in db2 Luw i believe the os is of mainframes. In tht case u r in wrong blog and the error says invalid '?' found please chk tht.

regds
Paul
Reply With Quote
  #3 (permalink)  
Old 01-18-11, 15:32
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
you can get mainframe help here as well as LUW. A forum that is monitored by more folks on the mainframe is IDUG's DB2-L.
How are you performing these inserts? as stated above, it seems however you are doing it, the concat operators are being translated to ?. you may want to try writing "concat "instead of "||"

Dave Nance
Reply With Quote
  #4 (permalink)  
Old 01-28-11, 08:22
dbzTHEdinosaur dbzTHEdinosaur is offline
Registered User
 
Join Date: Jun 2007
Location: germany
Posts: 96
on my mainframe !! is interpreted as the concat operator.
__________________
Dick Brenholtz, Ami in Deutschland
Reply With Quote
  #5 (permalink)  
Old 01-28-11, 10:45
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
I think your problem may be that you appear to be doing a line break after the || on your input file. A string (including concats) must all be on one line (or least no line breaks before the end of the string).
__________________
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

Tags
concat, db2, insert, pipes

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