f



how to get parameter value from dynamic select statement ?

Hi,

 running DB2 UDB 7.2 F.P 12 on WIndows

 Developers debug old application
 and need to get value passed to db2 by application

 I run db2cli trace and event monitor and both cases I get

 SELECT T1.* FROM
	UCIT.UPS_INVOIC
	MSG T1,  UCIT.	UPS_MSG_PRICEGRP
	 T2, UCIT.UPS_PRICE_CUST_GRP T3
	 WHERE .T1.MSG_NUM = T2.MSG_NUM AND.T2.TYPE = 'I'
	AND.T2.GROUP_NAME = T3.GROUP_NA	ME AND.T3.CUSTOMER_NUMBER = ?
	AND T1.EFFECTIVE_TS <= ? AND T1.EXPIRATION_TS >= ?

 I need values to get values of T1.EFFECTIVE_TS <= ? AND
T1.EXPIRATION_TS

0
t2581
10/14/2005 2:14:25 PM
comp.databases.ibm-db2 12448 articles. 3 followers. arunrocks (9) is leader. Post Follow

2 Replies
265 Views

Similar Articles

[PageSpeed] 9

t2581@hotmail.com wrote:

> Hi,
> 
>  running DB2 UDB 7.2 F.P 12 on WIndows
> 
>  Developers debug old application
>  and need to get value passed to db2 by application
> 
>  I run db2cli trace and event monitor and both cases I get
> 
>  SELECT T1.* FROM
> UCIT.UPS_INVOIC
> MSG T1,  UCIT.        UPS_MSG_PRICEGRP
> T2, UCIT.UPS_PRICE_CUST_GRP T3
> WHERE .T1.MSG_NUM = T2.MSG_NUM AND.T2.TYPE = 'I'
> AND.T2.GROUP_NAME = T3.GROUP_NA       ME AND.T3.CUSTOMER_NUMBER = ?
> AND T1.EFFECTIVE_TS <= ? AND T1.EXPIRATION_TS >= ?
> 
>  I need values to get values of T1.EFFECTIVE_TS <= ? AND
> T1.EXPIRATION_TS

This statement is run through SQLPrepare(), right?  The result is a
statement handle ("hstmt" in the CLI trace).  You should see a few
SQLBindParameter() calls following that and then a SQLExecute().  Have a
look at the stuff in the SQLExecute as it should tell you the actual
parameters used for the execution of the statement.

-- 
Knut Stolze
DB2 Information Integration Development
IBM Germany
0
Knut
10/17/2005 11:50:02 AM
the is no  SQLExecute

only SQLBindParameter and SQLExecDirectW
SQLBindParameter( hStmt=2:2, iPar=1, fParamType=SQL_PARAM_INPUT,
fCType=SQL_C_CHAR, fSQLType=SQL_VARCHAR, cbColDef=128, ibScale=0,
rgbValue=&01c755c8, cbValueMax=128, pcbValue=&00c12ecc )
    ---> Time elapsed - +3.770000E-004 seconds

SQLBindParameter( )
    <--- SQL_SUCCESS   Time elapsed - +3.856000E-003 seconds

SQLBindParameter( hStmt=2:2, iPar=2, fParamType=SQL_PARAM_INPUT,
fCType=SQL_C_CHAR, fSQLType=SQL_VARCHAR, cbColDef=128, ibScale=0,
rgbValue=&01c76d18, cbValueMax=128, pcbValue=&01c75484 )
    ---> Time elapsed - +3.490000E-004 seconds

SQLBindParameter( )
    <--- SQL_SUCCESS   Time elapsed - +3.862000E-003 seconds

SQLBindParameter( hStmt=2:2, iPar=3, fParamType=SQL_PARAM_INPUT,
fCType=SQL_C_CHAR, fSQLType=SQL_VARCHAR, cbColDef=128, ibScale=0,
rgbValue=&01c779d0, cbValueMax=128, pcbValue=&01c754dc )
    ---> Time elapsed - +3.340000E-004 seconds

SQLBindParameter( )
    <--- SQL_SUCCESS   Time elapsed - +4.019000E-003 seconds

SQLExecDirectW( hStmt=2:2, pszSqlStr="SELECT T1.* FROM
UCIT.UPS_INVOICE_MSG T1,  UCIT.UPS_MSG_PRICEGRP T2,
UCIT.UPS_PRICE_CUST_GRP T3 WHERE 	T1.MSG_NUM = T2.MSG_NUM AND	T2.TYPE =
'I' AND	T2.GROUP_NAME = T3.GROUP_NAME AND	T3.CUSTOMER_NUMBER = ? AND
T1.EFFECTIVE_TS <= ? AND T1.EXPIRATION_TS >= ?" -
X"530045004C004500430054002000540031002E002A002000460052004F004D00200055004300490054002E005500500053005F0049004E0056004F004900430045005F004D00530047002000540031002C002000200055004300490054002E005500500053005F004D00530047005F00500052004900430045004700520050002000540032002C00200055004300490054002E005500500053005F00500052004900430045005F0043005500530054005F0047005200500020005400330020005700480045005200450020000900540031002E004D00530047005F004E0055004D0020003D002000540032002E004D00530047005F004E0055004D00200041004E0044000900540032002E00540059005000450020003D002000270049002700200041004E0044000900540032002E00470052004F00550050005F004E0041004D00450020003D002000540033002E00470052004F00550050005F004E0041004D004500200041004E0044000900540033002E0043005500530054004F004D00450052005F004E0055004D0042004500520020003D0020003F00200041004E0044002000540031002E004500460046004500430054004900560045005F005400530020003C003D0020003F00200041004E0044002000540031002E00450058005000490052004100540049004F004E005F005400530020003E003D0020003F00",
cbSqlStr=256 )
    ---> Time elapsed - +3.530000E-004 seconds
( StmtOut="SELECT T1.* FROM UCIT.UPS_INVOICE_MSG T1,
UCIT.UPS_MSG_PRICEGRP T2, UCIT.UPS_PRICE_CUST_GRP T3 WHERE  T1.MSG_NUM
= T2.MSG_NUM AND T2.TYPE = 'I' AND T2.GROUP_NAME = T3.GROUP_NAME AND
T3.CUSTOMER_NUMBER = ? AND T1.EFFECTIVE_TS <= ? AND T1.EXPIRATION_TS >=
?" )

0
t2581
10/17/2005 6:26:14 PM
Reply: