java.sql.SQLException: ORA-01403: no data found

Cause: This exception is usually caused by no data return from query in Oracle procedure, trigger, etc. esp, insertion, deletion or update of a database operation is rolled back and the whole process fails after this exception.

Solution: as one solution : adding Oracle no data found exception handling (red part below), which can bypass this error
e.g
CREATE OR REPLACE PROCEDURE no_data_proc IS
   dummy dual.dummy%TYPE;
BEGIN
  BEGIN
     SELECT dummy 
       INTO dummy
       FROM dual
      WHERE dummy = 'Y';  
  EXCEPTION
     WHEN no_data_found THEN
        dbms_output.put_line('Why is this needed?');
  END;

END no_data_proc;

it's also possible caused by following statements, but the trigger error just reported the first line in trigger definition. 

e.g there are two statements in trigger, but reported error for the line of first select statement

xxx
BEGIN

 select x from x 

 SELECT LTrim(RTrim(VALU)) INTO N2_SERVICE_LEVEL FROM table_layout WHERE SETTING = 'N2'; //this line is very suspicious .


No comments :

Post a Comment