View previous topic :: View next topic
|
Author |
Message |
Sachinincsc
New User
Joined: 01 Oct 2008 Posts: 11 Location: Philadelphia, USA
|
|
|
|
wat will be the resultant of the QUERY is the MASTER_ID exists in the table..
EXEC SQL
DECLARE C3_TESTCUR CURSOR FOR
SELECT MASTER_ID
FROM SCHED_DATE_TABLE
WHERE COMPANY_CODE = :WS-IN-COMP-CODE
AND MASTER_ID <= :SAVE-END-POL-NUM
ORDER BY MASTER_ID DESC
OPTIMIZE FOR 1 ROW
END-EXEC.
Which operator will return the value ? = or < ( if MASTER_ID is present in the table). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Your question is not clear. . .
Show some sample rows (using both columns values) and someone will be able to explain what would be returned.
Quote: |
Which operator will return the value ? = or < ( if MASTER_ID is present in the table). |
If i understand your question rows that are matching the company code and are equal or less than the SAVE-END-POL-NUM will qualify.
I do not understand why you separate the "=" and the "<" in your question |
|
Back to top |
|
|
Sachinincsc
New User
Joined: 01 Oct 2008 Posts: 11 Location: Philadelphia, USA
|
|
|
|
Dick,
I only coded this cursor and was concerned if the MASTER-ID is equal to save-end-pol-num what it will return. ( SAVE-END-POL-NUM or lesser value).
But things are clear now. Thanks 4 your time.
This CURSOR may be used to fetch the second highest value of a particular feild from a particular (passed logically) in a table.
My requirement was to establish the following START command thru a DB2 cursor. so i coded the above mentioned cursor.
START SCHED1 KEY NOT GREATER SCHED-REC-KEY ( applied on a VSAM FILE)
Works fine for me
Thanks DIck
Sachin |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - good luck
d |
|
Back to top |
|
|
|