|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
calling View in passthru function |
« View previous topic :: View next topic » |
Author |
Message
|
anilmekala |
Posted: Mon Sep 21, 2015 4:08 am Post subject: calling View in passthru function |
|
|
Acolyte
Joined: 19 Oct 2012 Posts: 63
|
Hi All,
As part of my requirment i have to call DB2 view in my ESQL code.
I have created view in DB2 studio and have ran select function its working fine.
created View :
CREATE OR REPLACE VIEW "ESBVIEWER"."VW_CONTACTDETAILS_CI_CUSTMAST" ("CustomerFullName", "CustomerFirstName", "CustomerLastName", "DateofBirth", "AddressLine1", "AddressLine2", "AddressLine3", "City", "PINCode", "State", "Country", "EmailID", "MobileNumber", "Gender", "CustomerID") AS
SELECT
C.NAM_CUST_FULL,
c.nam_cust_first,
c.nam_cust_last,
C.DAT_BIRTH_CUST,
C.TXT_CUSTADR_ADD1,
C.TXT_CUSTADR_ADD2,
C.TXT_CUSTADR_ADD3,
C.nam_custadr_city,
C.nam_custadr_state,
C.nam_custadr_cntry,
C.txt_custadr_zip,
C.ref_cust_email,
C.ref_cust_telex,
C.txt_cust_sex,
C.COD_CUST_ID
FROM YBL.CI_CUSTMAST C
WHERE flg_mnt_status = 'A';
SELECT * FROM "ESBVIEWER"."VW_CONTACTDETAILS_CI_CUSTMAST";
select "MobileNumber" from "ESBVIEWER"."VW_CONTACTDETAILS_CI_CUSTMAST" WHERE "CustomerID" = 1234;
ESQL code :
SET sqlString = 'select VW.MobileNumber AS MobileNumber from ESBVIEWER.VW_CONTACTDETAILS_CI_CUSTMAST AS VW WHERE VW.CustomerID=?';
SET Environment.Variables.MobileNumber = PASSTHRU(sqlString,cCustomerId);
When i use same select function in my esql code I am getting
below exception:
Text:CHARACTER:[IBM][CLI Driver][DB2/NT64] SQL0206N "CUSTOMERID" is not valid in the context where it is used. SQLSTATE=42703
Please help me what could be the reason.
Regards,
Anil. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Sep 21, 2015 4:37 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The passthru is wrong
Code: |
SET Environment.Variables.MobileNumber = PASSTHRU(sqlString,cCustomerId);
|
should be:-
Code: |
SET Environment.Variables.MobileNumber[] = PASSTHRU(sqlString,cCustomerID);
|
at the very least. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
vishnurajnr |
Posted: Mon Sep 21, 2015 5:03 am Post subject: |
|
|
 Centurion
Joined: 08 Aug 2011 Posts: 134 Location: Trivandrum
|
Use double quotes for case sensitive column names:
something like
Quote: |
SET sqlString = 'select VW.MobileNumber AS MobileNumber from ESBVIEWER.VW_CONTACTDETAILS_CI_CUSTMAST AS VW WHERE VW."CustomerID"=?'; |
|
|
Back to top |
|
 |
anilmekala |
Posted: Mon Sep 21, 2015 5:15 am Post subject: |
|
|
Acolyte
Joined: 19 Oct 2012 Posts: 63
|
Hi ,
Thanks much.Its working fine. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|