Quote:
FOR REC IN (SELECT PERIOD FROM tab1)
LOOP
IF acct_prd <> REC.PERIOD
THEN
RAISE e_NO_DATA_ERROR;
END IF;
END LOOP;
|
SELECT PERIOD FROM tab1;
PERIOD
------
2001
2002
2003
2004
2005
acct_prd is the IN parameter.
Record above has about 5 rows and when acct_prd=2003, it should not throw an error but
when I say rec.period it encounters 2001 first and as acct_prd <> 2001, its throwing an exception.
Any better way of writing this?