Oracle Sql Error 1403
Contents |
easiest fix would be is to handle the error in the PL/SQL block, When a SQL statement is written ora-01403 no data found in oracle apps within a PL/SQL block, enclose the SQL with a BEGIN and
Ora 01403 No Data Found Ora 06512 In Oracle
END statement. Handle the exception and raise a user-friendly message or handle the rest of the processing. Eg: ora-01403 no data found in package 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 ora-01403 no data found select into 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 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
Ora 01403 No Data Found In Procedure Oracle
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 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 e
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 about Stack Overflow the company ora 01403 no data found apex Business Learn more about hiring developers or posting ads with us Stack Overflow Questions ora-01403 is the error number for exception Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million
Ora-01403 No Data Found Exception Handling
programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Oracle PL/SQL - ORA-01403 “No data found” when using “SELECT INTO” up vote 4 down vote favorite I faced this problem http://www.orafaq.com/wiki/ORA-01403 while developing a Trigger in Oracle: ORA-01403: no data found. I did some research and understood the root of the problem. Nevertheless handling the error exception prevents the above error, but does not solve my problem. What I am currently looking for is an optimal workaround to perform the lesser query amount/achieve the best performance as possible. I'll try to describe the scenario creating simple examples to the real structure. Scenario I have a http://stackoverflow.com/questions/22026100/oracle-pl-sql-ora-01403-no-data-found-when-using-select-into "date reference" table to establish periods of time, say: CREATE TABLE DATE_REFERENCE ( DATE_START DATE NOT NULL, DATE_END DATE NOT NULL, -- Several other columns here, this is just a silly example CONSTRAINT PK_DATE_REFERENCE PRIMARY KEY(DATE_START, DATE_END) ); When the trigger is triggered, I'll have one DATE field - say DATE_GIVEN (for example sake). What I need is: To find the DATE_REFERENCE row in which DATE_GIVEN BETWEEN DATE_START AND DATE_END (easy); OR If the previous option returns no data, I need to find the next closest DATE_START to DATE_GIVEN. In both cases, I need to retrieve the row with all columns from table DATE_REFERENCE, no matter if it matches Opt 1 or 2. That's exactly where I faced the problem described. I wrote this test block to test and try to find a solution. The example below is not working, I know; but it is exactly what I want to accomplish (in concept). I have added comments like -- Lots of code to make clear that will be part of a more elaborate trigger: DECLARE DATE_GIVEN DATE; RESULTROW DATE_REFERENCE%ROWTYPE; BEGIN -- Lots of code -- Lots of code -- Lots of code DATE_GIVEN := TO_DATE('2014-02-26 12:30:00', 'YYYY-MM-DD HH24:MI:SS'); -- This one throws the ORA-01403 exception if no data was found SELECT * INTO RESULTROW FROM DATE_REFERENCE WHERE DATE_GIVEN BET
Library mySQL Code Library PHP Code Library JavaScript Code Library Oracle Terms http://psoug.org/oraerror/ORA-01403.htm & Definitions Oracle Error Codes PSOUG Community Blogs Oracle Jobs Board PSOUG Forum Oracle User Group Directory Free Oracle Magazines Online Learning Center PSOUG Presentations http://www.dbasupport.com/forums/showthread.php?8309-ORA-01403-no-data-found-how-do-you-solve-this Advanced Code Search News and Events Sponsors Page Submit Code Contact Us Oracle Error: ORA-01403 Error Description: No data found Error no data 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. In other words, this error occurs when a SQL statement, written within a PL/SQL block, does not fetch any data. This may no data found be because you executed a SELECT INTO statement and no rows were returned, or you referenced an uninitialized row in a table, or because you read past the end of file with the UTL_FILE package. Action: Terminate processing for the SELECT statement. This error is often associated with the SELECT INTO clause. To avoid ORA-01403, the PL/SQL has to contain exceptions or the query will offer no values to the defined variable. If the exceptions are not defined properly, you will encounter ORA-01403. There haven't been any comments added for this error yet. You may add one if you like. Add a comment Name: Email: URL: Chars left:1000 (1000 max) (No HTML, but newlines will be preserved) Home : Code Library : Sponsors : Privacy : Terms of Use : Contact Us 76 users online © 2009 psoug.org PSOUG LOGIN Username: Password: Forgot your password?
data found, how do you solve this? If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 13 Thread: ORA-01403: no data found, how do you solve this? Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 03-22-2001,02:37 PM #1 coolmandba View Profile View Forum Posts Junior Member Join Date Dec 2000 Posts 87 Hi all, I'm trying do a 'INSERT' into a table and I received this message... ORA-01403: no data found What does it mean, and how do you solve it? Thanks. Reply With Quote 03-22-2001,03:14 PM #2 irehman View Profile View Forum Posts Senior Member Join Date Dec 2000 Location Virginia, USA Posts 455 I got this from Oracle Book. I don't know if this will help you. ORA-01403 no data found 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. Reply With Quote 03-22-2001,03:19 PM #3 coolmandba View Profile View Forum Posts Junior Member Join Date Dec 2000 Posts 87 Thanks. I also checked the documentation and yield exact the same content as what you got here, but it still doesn't solve my problem. Reply With Quote 03-22-2001,03:21 PM #4 irehman View Profile View Forum Posts Senior Member Join Date Dec 2000 Location Virginia, USA Posts 455 Can you post your insert statement with Table Defination? Reply With Quote 03-22-2001,03:48 PM #5 coolmandba View Profile View Forum Posts Junior Member Join Date Dec 2000 Posts 87 Actually, the problem laid on the trigger that associate with the table, the part starting with select nvl(keypart1_use,'nothing')..... if ....... If I comment out that section there is no problem, just that