Page 1 of 1

Dynamic replacing in WHERE clause

PostPosted: Sun Mar 08, 2015 4:52 am
by vegafacundodaniel
Hello. In my program cobol/db2, I am using theses sentences:


01 cond1 pic x(30).
01 var-employe pic 9(8).

move "nroemp1 = :var-employe'" to cond1
move 11111111 to var-employe

EXEC SQL
Select nroemp
into ws-nroemp
from table
where cond1
AND nroemp2 = 99999999
END-EXEC.


and when I compile, I get an error on the WHERE.
Could anyone help me, please?

I am hoping after the dynamic replacing my query be:

EXEC SQL
Select nroemp
into ws-nroemp
from table
where nroemp1= 11111111
AND nroemp2 = 99999999
END-EXEC.



thanks in advance

Re: Dynamic replacing in WHERE clause

PostPosted: Sun Mar 08, 2015 1:28 pm
by NicC
What error are you getting?
What is your analysis of the error after studying the manuals?

Re: Dynamic replacing in WHERE clause

PostPosted: Sun Mar 08, 2015 7:09 pm
by vegafacundodaniel
SQLCODE : -000000104
I didn't find this topic in the manuals
thanks

Re: Dynamic replacing in WHERE clause

PostPosted: Sun Mar 08, 2015 8:25 pm
by Robert Sample
Google is your friend. Googling sqlcode -104 returns 806,000 hits -- you should be able to figure out your problem from them.

Re: Dynamic replacing in WHERE clause

PostPosted: Sun Mar 08, 2015 9:43 pm
by vegafacundodaniel
Yes!!! thanks very much!
I solved my problem :)