SELECT INTO & no data found
19901Jan 22 2003 — edited Jan 23 2003I am writing a PL/SQL block with nested SELECT INTO...like
SELECT fld1
INTO var1
FROM tbl1
WHERE x=y
IF var1 is NULL Then -- No rows selected
SELECT fld2
INTO var2
FROM tbl2
WHERE a=b
IF var2 is NULL Then -- No rows here too
SELECT fld3
INTO var3
FROM tbl3
WHERE c=d
END IF;
END IF;
I know the above PL/SQL will raise exception NO_DATA_FOUND but can I use the SQL%ROWCOUNT or the SQL%NOTFOUND and if YES could anyone help me how to use it with the SELECT INTO.... Also What is the efficient way to code this block?
I would appreciate any help. Thanks