sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Sirsuram's Avatar

Dynamic SQL


Question posted by: Sirsuram (Newbie) on August 19th, 2008 03:56 PM
Hi ,
I am facing problme with my code. it is not displaying the results of SELECT statement
MOVE 'SELECT AAA, BBB FROM sample
- ' WHERE AAA = 03 AND BBB = 86102104
- ' FETCH FIRST 1 ROW ONLY'
TO QUERY-DATA
DISPLAY "QUERY1: " QUERY-DATA
EXEC SQL
PREPARE S1 FROM :QUERY1
END-EXEC.
IF SQLCODE NOT EQUAL 0
MOVE SQLCODE TO WS-SQLCODE
DISPLAY "SQLCODE 1: " WS-SQLCODE
END-IF.

EXEC SQL
EXECUTE S1
END-EXEC.
IF SQLCODE NOT EQUAL 0
MOVE SQLCODE TO WS-SQLCODE
DISPLAY "SQLCODE 1: " WS-SQLCODE
END-IF.


MOVE NRXPMD-FILL-NO TO VAR-DIS1
MOVE NRXPMD-INVNO TO VAR-DIS2
DISPLAY 'NRXPMD_FILL_NO : ' VAR-DIS1
DISPLAY 'NRXPMD_INVNO : ' VAR-DIS2 .
GOBACK.

when I execute the abov code the SQL codes for PREPARE and ECECUTE are asbelow.

SQLCODE 1: 0031J
SQLCODE 1: 0051Q

Please help me!
0 Answers Posted
Reply
Not the answer you were looking for? Post your question . . .
197,008 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,008 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top DB2 Contributors