ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problem with insert statement in ESQL

Post new topic  Reply to topic
 Problem with insert statement in ESQL « View previous topic :: View next topic » 
Author Message
Aradhana
PostPosted: Wed Jun 16, 2004 6:16 am    Post subject: Problem with insert statement in ESQL Reply with quote

Newbie

Joined: 16 Jun 2004
Posts: 2

Hi,

I have written esql as "INSERT INTO Database.TABLE1 VALUES(SELECT T.* FROM Database.TABLE2 T)" in Compute node. Its not showing any syntax error in esql but its giving error bcoz of this statement while deployment.

Kindly suggest.

Thanks and Regards
Aradhana
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jun 16, 2004 6:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You need to always qualify your databases with correlation names using the 'AS' clause.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Aradhana
PostPosted: Wed Jun 16, 2004 6:22 pm    Post subject: Reply with quote

Newbie

Joined: 16 Jun 2004
Posts: 2

sorry i missed 'AS' ,now the esql is
INSERT INTO Database.MGCCJRNB VALUES(SELECT T.* FROM Database.MGCCJRNL AS T );

But still its giving error while deploying ....
Back to top
View user's profile Send private message
fazz
PostPosted: Thu Jun 17, 2004 12:04 am    Post subject: Reply with quote

Centurion

Joined: 20 Feb 2004
Posts: 144
Location: England

Shouldn't this....

Quote:
INSERT INTO Database.MGCCJRNB VALUES(SELECT T.* FROM Database.MGCCJRNL AS T );


be this....

INSERT INTO Database.MGCCJRNB(COLNAME) VALUES(SELECT T.* FROM Database.MGCCJRNL AS T );
Back to top
View user's profile Send private message
mqsidude
PostPosted: Thu Jun 17, 2004 2:25 am    Post subject: Reply with quote

Centurion

Joined: 22 Jan 2004
Posts: 148

The stmt "SELECT T.* FROM Database.MGCCJRNL AS T" will always return a list (array) of values. You have to capture them into a variable array first and then insert them in a different INSERT stmt.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Jun 17, 2004 2:36 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

mqsidude wrote:
The stmt "SELECT T.* FROM Database.MGCCJRNL AS T" will always return a list (array) of values. You have to capture them into a variable array first and then insert them in a different INSERT stmt.

Not necessarily.

Aradhana wrote:
sorry i missed 'AS' ,now the esql is
INSERT INTO Database.MGCCJRNB VALUES(SELECT T.* FROM Database.MGCCJRNL AS T );

But still its giving error while deploying ....

Please review the documentation for the ESQL statement "Insert". It's not the same as a regular SQL Insert statement.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kirani
PostPosted: Thu Jun 17, 2004 10:58 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Use the PASSTHRU command instead.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
mgk
PostPosted: Mon Jun 21, 2004 5:40 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

You cannot currently INSERT a list (the return from a SELECT in your case). You have to do this in two stages (SELECT into a tree then INSERT individual columns) or use passthru as suggested above.

Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problem with insert statement in ESQL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.