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 » Need help from ESQL guru

Post new topic  Reply to topic
 Need help from ESQL guru « View previous topic :: View next topic » 
Author Message
narendra
PostPosted: Fri Jul 12, 2002 12:12 pm    Post subject: Need help from ESQL guru Reply with quote

Apprentice

Joined: 04 Jun 2002
Posts: 26

This is my input message:
<Message>
<ACTION>INSERT</ACTION>
<TEST1>HIT1 10</TEST1>
</Message>

This is what is in my database node and it works. Please note I hardcoded the table
name and the column name in the insert statement.

If Body.Message.ACTION = 'INSERT' THEN
INSERT
INTO Database.DAVID.TEST1 (COL1)
VALUES (Body.Message.TEST1);
END IF;

However, I would like NOT to hardcode the the insert statement with the table name and column name but have them picked up from some varaibles ; that is,

I would like my input message to be
<Message>
<ACTION>INSERT</ACTION>
<TABLE>DAVID.TEST1</TABLE>
<COLUMN>COL1</COLUMN>
<TEST1>HIT1 10</TEST1>
</Message

How to code the database node to pick up the table name and column name dynamically ?

If Body.Message.ACTION = 'INSERT' THEN
INSERT
INTO Database.XXXX (YYY )
VALUES ((Body.Message.TEST1);
END IF;

what ESQL functions should I use to resolve XXXX to David.TEST1
and YYY to COL1 ?


Thanks in advance
Narendra
Back to top
View user's profile Send private message
narendra
PostPosted: Fri Jul 12, 2002 1:58 pm    Post subject: How to pick up the table name dynamically from the insert DB Reply with quote

Apprentice

Joined: 04 Jun 2002
Posts: 26

I can resolve the value of YYY by declaring
DECLARE YYY REFERENCE TO Body.Message.COLUMN and it works.

Howver it still fails on the XXX because after INTO it expects 'Database' keyword
These are what I have UNSUCCESSFULLY tried :


If Body.Message.ACTION = 'INSERT' THEN
INSERT
INTO Body.Message.TABLE (YYY ) // It fails because it expects the Database keyword
VALUES ((Body.Message.TEST1);
END IF;

DECLARE TABLE CHARACTER;
SET TABL=Body.Message.TABLE;
If Body.Message.ACTION = 'INSERT' THEN
INSERT
INTO Database.(SUBSTRING(TABL FROM 1 FOR LENGTH(TABL)))(YYY )
-- It fails because it thinks Database.(SUBSTRING.....as the database name)
VALUES ((Body.Message.TEST1);
END IF;


Thanks in advance
Narendra
Back to top
View user's profile Send private message
kirani
PostPosted: Fri Jul 12, 2002 2:40 pm    Post subject: Reply with quote

Jedi Knight

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

You could try using EVAL statement to build your INSERT statement dynamically.
_________________
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
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Need help from ESQL guru
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.