Tuesday, 24 March 2015

ORA-01403: no data found



--The Error is ORA-01403: no data found


DECLARE
   xxdeptno   NUMBER;
BEGIN
   SELECT deptno
     INTO xxdeptno
     FROM scott.emp
    WHERE deptno = 80;---passing dummy ID by Lokanadham Thandlam
   DBMS_OUTPUT.put_line ('The Department is ' || xxdeptno);
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('The Error is ' || SQLERRM);
END;



Cause: In a host language program, all records have been fetched. 
The return code from the fetch was +4, indicating that all records have been returned from the SQL query.


Action:  Terminate processing for the SELECT statement.