View previous topic :: View next topic
|
Author |
Message |
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi All
I have a input variable XXXX-A PIC S9(9)V9(2).
I want to use this variable in my SQL query so in order to use it an host variable i declared a working storage variable
WS-XXXXX-A PIC S9(9)v9(2) COMP-3
then
MOVE XXXX-A TO WS-XXXXX-A
exec sql
select from
where WS-XXXXX-A = COULUM
en-exec
Is there any mistake in am doing this |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
depends on the data type of the column. |
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi
My coulum data type is decimal
and the dclegen am rtreving is PIC S9(8)V9(2) COMP-3 |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
akodakka wrote: |
Hi All
I have a input variable XXXX-A PIC S9(9)V9(2).
I want to use this variable in my SQL query so in order to use it an host variable i declared a working storage variable
WS-XXXXX-A PIC S9(9)v9(2) COMP-3
then
MOVE XXXX-A TO WS-XXXXX-A
exec sql
select from
where WS-XXXXX-A = COULUM
en-exec
Is there any mistake in am doing this |
You should post source code using BBCode tags, to enhance readability. An do preceede your host variable name with a colon in sql:
Code: |
exec sql
select from
where :WS-XXXXX-A = COULUM
en-exec
|
|
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi i am using proper colons.. |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
Ok, then go ahead and program your SQL.
It is good practice to include the DCLGEN structure for the accessed tables in your program and use the host language definitions of columns as host variables, instead of defining your own working storage elements. |
|
Back to top |
|
|
|