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 » calling View in passthru function

Post new topic  Reply to topic
 calling View in passthru function « View previous topic :: View next topic » 
Author Message
anilmekala
PostPosted: Mon Sep 21, 2015 4:08 am    Post subject: calling View in passthru function Reply with quote

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
View user's profile Send private message
smdavies99
PostPosted: Mon Sep 21, 2015 4:37 am    Post subject: Reply with quote

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
View user's profile Send private message
vishnurajnr
PostPosted: Mon Sep 21, 2015 5:03 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
anilmekala
PostPosted: Mon Sep 21, 2015 5:15 am    Post subject: Reply with quote

Acolyte

Joined: 19 Oct 2012
Posts: 63

Hi ,

Thanks much.Its working fine.
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 » calling View in passthru function
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.