View previous topic :: View next topic
|
Author |
Message |
krithikaj
New User
Joined: 10 Aug 2008 Posts: 45 Location: India
|
|
|
|
Hi,
I have a table where the Pkey is defined as identity column (GENERATED BY DEFAULT BY IDENTITY).
I am using this table in one of the SELECT cursors in my COBOL-CICS-DB2 program. I send the value as -1 for this coumn in my input to the program. My question here is, before I insert a row, I have a select query in which I am joining this table on this identity column. What would be the value that would be considered and the possible SQLCODE of the cursor?
Thanks
K J |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you set a value to -1, the value will be -1 . . . (unless you are possibly talking about a null indicator). . .
I have no idea what this means - maybe clarification can be provided:
Quote: |
What would be the value that would be considered and the possible SQLCODE of the cursor? |
|
|
Back to top |
|
|
krithikaj
New User
Joined: 10 Aug 2008 Posts: 45 Location: India
|
|
|
|
Hi Dick,
I have table name ITEM where ITEM_ID is defined as GENERATED BY DEFAULT AS IDENTITY.
Now i have COB-CICS-DB2 program PGM1 for which the INPUT-COPYBOOK has value for ITEM_ID = -1. In the program, I have a CURSOR1 which performs SELECT function say like this..
SELECT A.COL1, B.COL2, C.COL3
FROM A
LEFT OUTER JOIN B ON
A.COL3 = B.COL3
LEFT OUTER JOIN ON
A.COL2. C.COL2
LEFT OUTER JOIN ON ITEM D ON
B.ITEM_ID = -1 (VALUE FROM INPUT_COPYBOOK)
Then, I would like to know whether what would be the value for SQLCODE when this cursor is fetched as the ITEM_ID in table cannot be -1.
Thanks,
K J |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you post the actual sql using the real table and column names rather than the alphabet soup that provides little continuity.
What happens when you run the query on your system? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
-1 is a valid value for an identity column.
This would work just like if the variable contained f.e. 913467 |
|
Back to top |
|
|
krithikaj
New User
Joined: 10 Aug 2008 Posts: 45 Location: India
|
|
|
|
Thanks a lot for reply. |
|
Back to top |
|
|
|