own definition exceptions.function (you need to define a variable to receive)Sqlcode--Returns the code number of the error and returns 0 if there is no error, you can query the official document according to the value returned by Sqlcode for a more detailed description of the errorSQLERRM--Returns the text description of the error if no error is returned to normal or successful completion, which is the off
Common pre-defined exceptions of Oralce databases:
EXCEPTION
WHEN CURSOR_ALREADY_OPEN THEN -- ORA-06511 SQLCODE =-6511 the cursor has been opened
WHEN DUP_VAL_ON_INDEX THEN
-- ORA-00001 SQLCODE =-1 insert duplicate data into a unique index
WHEN INVALID_CURSOR THEN
-- ORA-01001 SQLCODE =-1001 illegal cursor operation
WHEN INVALID_NUMBER THEN -- ORA-01722
ExceptionWhen cursor_already_open then -- ORA-06511 sqlcode =-6511 the cursor has been opened
When dup_val_on_index then-- ORA-00001 sqlcode =-1 insert duplicate data into a unique index
When invalid_cursor then-- ORA-01001 sqlcode =-1001 illegal cursor operation
When invalid_number then -- ORA-01722 sqlcode =-1722 cha
Dynamic
Application of descriptor in dynamic SQL
Wang Guanghong
The flexibility of dynamic SQL is well known, and I am here to introduce a dynamic SQL that applies descriptor:
$short B_num;
$char *command;
$char sql[1024];
$short Flag;
$date date;
$long number, B_count, J;
$long Prec;
$long type;
$long Scale;
$double money;
sprintf (SQL, "SELECT * from table");
$prepare qid from $Sql;
if (SQLCODE) return-1;
$de
errors returned to PL/SQL blocks during execution or Oracle errors returned by PL/SQLCodeErrors Caused by an operation, such as Zero Divisor or memory overflow. Custom exceptions are displayed and defined by developers. Information is transmitted in PL/SQL blocks to control application error handling.
Every time PL/SQL violates Oracle principles or goes beyond system dependencies, internal exceptions are implicitly generated. Because each Oracle error has a number and the PL/SQL exception is
; EXCEPTION When No_data_found and then Dbms_output. Put_Line (' No Code in database ' | | v_empno| | ' Employees '); when Too_many_rows and then Dbms_output. Put_Line (' program run Error! Use cursor '); when OTHERS and then Dbms_output. Put_Line (sqlcode| | ' ---' | | SQLERRM); END; 2> non-pre-defined exception handlingFor handling this type of exception, you must first define a non-defined Oracle error. The steps are as follows:1. Define t
The following article describes how to handle exceptions in the DB2 stored procedure. In the DB2 database, if you want to use sqlcode, you must declare before the DDL statement. This is what we all need to know. The following describes the main content of this article.
Handling of Stored Procedure exceptions:
DECLAREhandler-typeHANDLERFORconditionhandler-action
The exception Processor type (handler-type) has the following types:
After the
processor operation is complete, continue continues to execute the next statement after the exception statement is generated.
After the processor operation is complete, exit terminates the stored procedure and returns the control to the caller.
Before undo executes a processor operation, DB2 rolls back the SQL operations performed during the stored procedure. After the processor operation is complete, the stored procedure is terminated and the control is returned to the caller.
Exce
=: Book-name;Bdesc =: Book-number;}(6) SQL Communication zoneThe SQL Communication zone is described using the following statements:Exec SQL include sqlca;This section provides records of success or failure and error handling for running programs.Sqlca CompositionSqlca is a variable of the structure type. It is an interface between Oracle and applications. When executing the Pro * C program, Oracle saves the status information of each embedded SQL statement execution to sqlca. Based on this inf
CompositionSQLCA is a variable of the structure type. It is an interface between ORACLE and applications. ORACLEStore the status information of each embedded SQL statement execution in SQLCA. Based on this information, you can determine whether the SQL statement execution is successful, the number of rows processed, and the error information, as shown in the table:Struct sqlca{Char sqlcaid [8]; ---- à identifies the communication zoneLong sqlabc; --- à length of the Communication zoneLong
;
v_node_templet_id td_m_node_templet.node_templet_id% type;
Begin
--V_NODE_TEMPLET_ID: = Please enter a node name; -This piece has not been realized, always reported the wrong
v_node_templet_id: = ' bizopporder ';
SELECT flow_templet_id to v_flow_templet_id from Td_m_node_templet a WHERE node_templet_id = v_node_templet_id;
Dbms_output.put_line (v_flow_templet_id);
EXCEPTION
--when No_data_found then
--dbms_output.put_line (' No data found ');
When OTHERS and
dbms_output.put_line (' @
variables.//In addition, multithreading requires the following issues to be considered://Define the SQLCA structure as thread-safe. A typical practice is to define a local variable with the same name at the beginning of each function.//The SQLDA structure is also treated like the SQLCA structure.//Define the host variables in the program as thread-safe. This means being careful with global and static variables in your program.//Avoid using the same run-time context for different threads at the
null instance when using an object type.
Storage_error (ora-06500): exceeds memory space or the memory is corrupted.
Sys_invalid_rowid (ora-01410): invalid string attempt to convert to rowid type.
Timeout_on_resource (ora-00051): timeout error while waiting for the resource.
Handle non-predefined exceptions:Oracle errors other than pre-defined in 21 described above are collectively referred to as non-pre-defined exceptions. The handling of such exceptions involves three steps: first, defining p
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.