View previous topic :: View next topic
|
Author |
Message |
ksathishkumar83
New User
Joined: 21 Nov 2006 Posts: 50 Location: India
|
|
|
|
The Cursor Declaration is
Declare Cur1 for
Select a,b from table 1
Fetch cur1 into :a1:x,:b1
whether the value of a in table1 is moved to a1 and x? |
|
Back to top |
|
|
ksathishkumar83
New User
Joined: 21 Nov 2006 Posts: 50 Location: India
|
|
|
|
In the above Declaration, I want to move the value a from table 1 to to two host variables.
Help me with the exact Declaration... |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Try select a, a, b? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
as you used it in your cursor,
x is the indicator field (mostly for null value) and must be defined as S9(4) COMP.
a goes into :a1 and b into :b1 |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
ksathishkumar83,
The way you have the fetch declared. Host variable ?x' is the null indicator for host variable ?a1?.
If column ?a? is not null, host variable ?x? will contain value 0, if column ?a? is null Host variable ?x? will contain -1. Also note that for this to not give you an error host variable ?x? must be defined as PIC S9(4) COMP.
If you want column ?a' to be populated in host variable ?a1? and ?x? you will need:
Code: |
Declare Cur1 for
Select a,a,b from table 1
Fetch cur1 into :a1,:x,:b1 |
Note the addition of the ?,? between ':a1' and ': x' |
|
Back to top |
|
|
|