Hi,
I created a sub routine and tried to execute a SQL query within it. In the
Client programm i called the Subroutine within the SQLExecDirect function.
Compilation, catalogging everything was fine. But the SQLExecDirect is
returing a value '-1' which is an error and with the SQLError function I
got the error as "invalid Cursor State".
please, help me in this regard.
Below is the block of code.
>ED TEST2.BP MAIN
11 lines long.
----: PP
0002: $INCLUDE UNIVERSE.INCLUDE ODBC.H
0003: PRINT "ENTER THE ITEM CODE: ": ; INPUT ITEM
0004: ST = SQLExecDirect(@HSTMT,"CALL SUB(":ITEM:")")
0005: PRINT ST
0006: IF ST <> 0 THEN
0007: E = SQLError(SQL.NULL.HENV, SQL.NULL.HDBC, @HSTMT, STATE, CODE, MSG)
0008: PRINT "SQLSTATE = ":STATE:", ERROR CODE = ":CODE:", ERROR TEXT = "
0009: PRINT MSG
0012: END
----: pp
0001: SUBROUTINE SUB(ITM)
0002: $INCLUDE UNIVERSE.INCLUDE ODBC.H
0003: S="SELECT ITEM_CODE,DESCRIPTION FROM INVENTORY.T WHERE ITEM_CODE =
":ITM
0004: ST = SQLExecDirect(@HSTMT,S)
0005: RETURN
>RUN TEST2.BP MAIN
ENTER THE ITEM CODE: ?6
-1
SQLSTATE = 24000, ERROR CODE = 0, ERROR TEXT =
[IBM][SQL Client]Invalid cursor state
Sanjeeb
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/