Hello,
one way to develop a lookup is to declare a cursor. This is the standard
way to declare a cursor:
ACCEPT sailorID NUMBER PROMPT 'Enter sailor id: '
DECLARE
CURSOR cuLookup IS
SELECT sid, trainee
INTO p_sid, p_trainee
FROM sailors
WHERE sid = &sailorID;
L number;
X number;
p_sid sailors.sid%TYPE;
p_trainee sailors.trainee%TYPE;
rLookup cuLookup%ROWTYPE;
BEGIN
L := 0;
X :=&SailorID;
OPEN cuLookup;
FETCH cuLookup INTO rLookup;
WHILE cuLookup%FOUND LOOP
END LOOP;
CLOSE(cuLookup);
EXCEPTION
WHEN OTHERS THEN
IF cuLookup%ISOPEN THEN
CLOSE cuLookup;
END IF;
END;
There ar several other ways to do a cursor fetch f.e. you can use a direct declarion in a for statement. Look into the oracle manual to get further details.
Hope that helps ?
Manfred Peter
(Alligator Company GmbH)
http://www.alligatorsql.com