1403 Oracle Error Code
Contents |
easiest fix would be is to handle the error in the PL/SQL block, When a SQL statement is written within a PL/SQL block, enclose the SQL with a BEGIN and END statement. Handle oracle error 1403 java.sql.sqlexception ora-01403 the exception and raise a user-friendly message or handle the rest of the processing.
Sqlcode 1403 In Oracle
Eg: CREATE OR REPLACE PROCEDURE test_proc (p_empno IN NUMBER) IS l_empname VARCHAR2(50); BEGIN SELECT empname INTO l_empname FROM emp WHERE empno = ora-01403 no data found in oracle forms p_empno; IF l_empname = 'Sarah Jones' THEN INSERT INTO empresult values ('105', 'Found Sarah Jones'); END IF; END; / The above procedure has not handled the error that would be raised if the select statement
Ora-01403 No Data Found In Oracle Apps
did not find the specified empno. See the following for the error raised: SQL> exec test_proc (1) begin test_proc (1); end; * ERROR at line 1: ORA-01403: no data found ORA-06512: at "TAROT.TEST_PROC", line 4 ORA-06512: at line 1 If you want the procedure to execute properly without errors on the screen, then you would have to handle the error. The Exception needs to be controlled by adding an exception handler ora-01403 no data found ora-06512 to the code. The above code has been modified to handle an exception NO_DATA_FOUND. This is the name of the exception that the error relates to. CREATE OR REPLACE PROCEDURE test_proc (p_empno IN NUMBER) IS l_empname VARCHAR2(50); BEGIN SELECT empname INTO l_empname FROM emp WHERE empno = p_empno; IF l_empname = 'Sarah Jones' THEN INSERT INTO empresult values ('105', 'Found Sarah Jones'); END IF; EXCEPTION WHEN NO_DATA_FOUND THEN INSERT INTO empresult values(p_empno, 'Did not find Sarah Jones'); END; / If you execute the above procedure now, this is what you would see: SQL> exec test_proc (1) PL/SQL procedure successfully completed. SQL> select * 2 from empresult; EMPNO EMPNAME --------- -------------------------------------------------- 1 Did not find Sarah Jones As the exception was handled, a row was inserted into the empresult table with the error message you specified. When the exception is raised, the control jumps from the select statement to the exception handler routine. Any code after the Select will not get executed if an exception has been raised. But if you do have some code that needs to be executed after the select has been executed, irrespective of whether the select was successful or not, then you would need to nest the begin and end statements. CREATE OR REPLACE PROCEDURE test_proc (p_empno IN
MySQL MariaDB PostgreSQL SQLite MS Office Excel Access Word Web Development HTML CSS
Ora-01403 No Data Found Select Into
Color Picker Languages C Language More ASCII Table Linux UNIX
Ora 01403 No Data Found Ora 06512 In Oracle
Java Clipart Techie Humor Advertisement Oracle Basics ALIASES AND AND & OR BETWEEN COMPARISON ora-01403 no data found in package OPERATORS DELETE DISTINCT EXISTS FROM GROUP BY HAVING IN INSERT INSERT ALL INTERSECT IS NOT NULL IS NULL JOIN LIKE MINUS NOT OR http://www.orafaq.com/wiki/ORA-01403 ORDER BY PIVOT REGEXP_LIKE SELECT SUBQUERY TRUNCATE UNION UNION ALL UPDATE WHERE Oracle Advanced Oracle Cursors Oracle Exception Handling Oracle Foreign Keys Oracle Loops/Conditionals Oracle Transactions Oracle Triggers String/Char Functions Numeric/Math Functions Date/Time Functions Conversion Functions Analytic Functions Advanced Functions Oracle / PLSQL: ORA-01403 Learn the https://www.techonthenet.com/oracle/errors/ora01403.php cause and how to resolve the ORA-01403 error message in Oracle. Description When you encounter an ORA-01403 error, the following error message will appear: ORA-01403: no data found Cause You tried one of the following: You executed a SELECT INTO statement and no rows were returned. You referenced an uninitialized row in a table. You read past the end of file with the UTL_FILE package. Resolution The option(s) to resolve this Oracle error are: Option #1 Terminate processing of the data. Share this page: Advertisement Back to top Home | About Us | Contact Us | Testimonials | Donate While using this site, you agree to have read and accepted our Terms of Service and Privacy Policy. We use advertisements to support this website and fund the development of new content. Copyright © 2003-2016 TechOnTheNet.com. All rights reserved.
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more http://stackoverflow.com/questions/3940522/why-is-no-data-found-ora-01403-an-exception-in-oracle about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why is no_data_found ORA-01403 an exception in Oracle? up vote 12 down no data vote favorite 2 If the SELECT INTO statement doesn't return at least one row, ORA-01403 is thrown. For every other DBMS I know this is normal on a SELECT. Only Oracle treats a SELECT INTO like this. 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; Why? no data found In my opinion you don't need this exception really. It is too much overhead. Sometimes it is handy but you have to write a whole BEGIN, EXCEPTION, WHEN, END Block. Are there any essential reasons I don't see? oracle exception exception-handling plsql ora-01403 share|improve this question edited Feb 12 '11 at 1:33 OMG Ponies 198k36356415 asked Oct 15 '10 at 8:12 Stephan Schielke 1,10551734 4 Don't forget to catch TOO_MANY_ROWS when the select returns more than one row. –Rene Oct 15 '10 at 13:19 add a comment| 6 Answers 6 active oldest votes up vote 15 down vote accepted The exception block is not needed, you might use it or not, depending on the context. Here you are actively ignoring the exception (the procedure will return successfully) but most of the time if you're doing a SELECT INTO you want it to fail if it doesn't return a row, consider: PROCEDURE update_employee_salary (p_empno) IS l_salary NUMBER; BEGIN SELECT sal INTO l_salary FROM emp WHERE empno = p_empno FOR UPDATE; /* do something with emp data */ END; Here I want my function to fail if it is called with an empno that doesn't exist in the EMP table. I might catch the exception to rai