RATE THIS ANSWER
0
Click to Vote:
0
0
There are several ways to do this. If you just want to read the record, put FOR 1 RECORD ONLY at the end of the SELECT in DB2. In Oracle, use a WHERE clause of ROWNUM<2. You must use <2 and not =1. If you want to be able to modify the first record, a cursor can do it for you. This example is in DB2 SQL:
DECLARE myCursor CURSOR FOR
SELECT stuff
FROM table
WHERE conditions;
OPEN myCursor;
FETCH myCursor INTO :stuff;
UPDATE table
SET field = expression
WHERE CURRENT OF myCursor;
CLOSE myCursor;
--
Sheldon Linker (sol@linker.com)
Linker Systems, Inc. (www.linkersystems.com)
800-315-1174 (+1-949-552-1904)