Oracle Common errors: root causes and solutions for ORA-01403 ____oracle

Source: Internet
Author: User
Tags exception handling
Oracle Common error: ORA-01403

ORA-06512: In "MALL." Pub_yang_logon_organ ", line 88
ORA-06512: On line 1

At Com.yangcq.flow.processflow.ProcessflowFunction.execute (processflowfunction.java:102)
At Com.opensymphony.workflow.AbstractWorkflow.executeFunction (abstractworkflow.java:869)
At Com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow (abstractworkflow.java:1042)
At Com.opensymphony.workflow.AbstractWorkflow.doAction (abstractworkflow.java:567)
At Com.yangcq.flow.processflow.BaseProcessflow.executeProcessflow (baseprocessflow.java:65)
At Com.yangcq.flow.processflow.BaseProcessflow.executeProcessflow (baseprocessflow.java:39)
At Com.yangcq.web.spring.DefaultFlowExecuteHandler.executeProcessflow (defaultflowexecutehandler.java:58)
At Com.yangcq.service.ProcessflowExecuteService.execute (processflowexecuteservice.java:164)
At Com.yangcq.flow.processflow.function.ProcessflowExecFunction.exec (processflowexecfunction.java:33)
... More
caused By:com.yangcq.Exception:root cause:sqlmapclient operation; SQL [];
---The error occurred in Config/sqlmap/public.xml.
---The error occurred while applying a parameter map.
---Check the public.pwderroroperate.
---Check the statement (update procedure failed).
---cause:java.sql.sqlexception:ora-01403: no data found

88 lines of SQL (for readability, I formatted this line of code and displayed multiple lines):
SELECT
Lcl_lastfail,lcl_failtoday into V_lastdate, V_failcount
From
Cb_logon_ctrl
WHERE
Lcl_branchid = In_branchid and
Lcl_userid = in_cstno| | In_userid;

Root cause: The SELECT statement query out of the result is empty, at this point the query out of the null value assigned to 2 variables, there is the above error. ORA-01403: No data found, report this error
is usually the reason for empty query results in the SELECT INTO statement. This error is a problem we often encounter when using Pl/sql for debugging.
Solution: Look at the problem with the data and cause the query result to be empty.

If we use Oracle's exception handling mechanism to catch this exception, the console will not print the error message.

Oracle Exception handling mechanism
For ease of development and maintenance, Oracle defines common exceptions, mainly the following:
1,dup_val_on_index exception Code ORA-00001 attempting to insert duplicate values into a unique indexed column
2,invalid_cursor exception Code ORA-01001 attempted an illegal cursor operation
3,invalid_number exception code ORA-01722 trying to convert a string into a number
4,no_data_found exception code ORA-01403 SELECT into statement without any return results
5,too_many_rows exception code ORA-01422 SELECT into statement returns results
6,zero_divide Anomaly code ORA-01476 trying to divide by 0
7,cursor_already_open exception Code ORA-06511 attempt to open a cursor that is already open

The Pl/sql keyword is used as the starting mark for the exception in the exception. Once an exception occurs for a stored procedure, the SQL after the exception statement is executed.

Extended reading: The ROWNUM keyword in Oracle
In the query's result set, the RowNum keyword identifies a line number for each row in the result set, the first line returns 1, the second row returns 2 ..., and so on. With the RowNum keyword, we can control the number of records in the query. As follows:
SELECT * from Ent_role WHERE rownum < 10; --Query the first 9 records in Ent_role
The difference between rownum and rowID: ROWID is generated when the record is inserted, identifies the physical address of the row, RowNum is generated when querying data, and identifies the order of rows in the query results.
Another point to note about RowNum is that the following wording does not return any query results:
SELECT * from Ent_role WHERE rownum > 10;
SELECT * from Ent_role WHERE rownum >= 10;

So how does Oracle implement pagination?
--oracle Paging Query
SELECT
*
From
(
SELECT
RowNum R,yangcq_id,yangcq_branchid
From
Yangcq_user
WHERE
RowNum <= 10
)
WHERE
R > 5;
Process parsing: The first step internal query gets rownum, and the individual name R; then the R column used by the external query is actually a column of the inner query, not the label of the line.
Similarly, a similar approach can be used:
SELECT
*
From
(
SELECT
RowNum R,yangcq_id,yangcq_branchid
From
Yangcq_user
)
WHERE
R > 5 and
R <= 10;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.