. The basic syntax is as follows:
DECLARE condition_name Condition for Condition_value
Condition_value:
SQLSTATE [VALUE] sqlstate_value | Mysql_error_code
Where the Condition_name parameter represents the name of the condition, the Condition_value parameter represents the type of condition, and the Sqlstate_value parameter and Mysql_error_code parameter can represent the MySQL error. For example, in error 1146 (42S02), the Sqls
connected to the backend (DB2BQTRY) = 60 Request queue waiting time (seconds) (DB2RQTIME) = 5 input queue waiting time (seconds) (DB2IQTIME) = 5 Command Option (DB2OPTIONS) =-c www.2cto.com option description current settings ------ -------------------------------------------------- a display sqlca off-c automatically implement ON-d retrieval and display XML declaration OFF-e display SQLCODE/sqlstate off-f Read input file OFF-I: Show XML data with in
Xid int;Select name, Id into newname, XidFrom proce where name = Name;Select newname;End;//
Call test1 ()//
#***Delimiter //Drop procedure if exists Test2 //
Create procedure Test2 ()BeginDeclare newname varchar (5 );Declare Xid int;Select name, Id into newname, XidFrom proce limit 1;Select newname, Xid;End;//
Call Test2 ()//
# Use testprocedure;Create procedure p1 () Select * From proce;
Call p1 ();
# # Not found is a shorthand for all sqlstate code
. It is only a SELECT statement used by ing Pharmaceuticals.
2) once declared, the cursor must be opened for use. In this process, the data is actually retrieved using the SELECT statement defined earlier.
3) for the cursor with data filled, retrieve the rows as needed
4) The cursor must be closed when the end cursor is used.
24.2 create and use cursor data
After a cursor is opened, you can use the FETCH statement to access each row of the cursor. FETCH specifies the data to be searched and wher
It's a bit messy, because some do not understand it. Wait until you understand it.
Start command line processor, CLPDb2cmd DB2Create Database my1stdb* The database name can contain the following characters: A-Z, a-Z, 0-9, @, #, and $.* The first character in the name must be an alphanumeric character, @, #, or $. It cannot be a number or a letter sequence sys, DBM, or IBM.* The database name or database alias is a unique string that contains one to eight letters, numbers, or keyboard characters
employee WEHRE id = 2;
14.1.4 define conditions and handling procedures
Defining conditions and processing programs is a problem that may occur during program execution. You can also define solutions to these problems in the handler. This method can predict possible problems in advance and propose solutions. In this way, the program's ability to handle problems can be enhanced to avoid abnormal program stop. MySQL uses the DECLARE keyword to define conditions and processing programs. This secti
Mysql experiences: Stored Procedure
Use test; drop table if exists t8; create table t8 (s1 INT, primary key (s1); drop procedure if exists handlerdemo; DELIMITER $ create procedure handlerdemo () BEGINdeclare xx int default 4; DECLARE oh_no condition for sqlstate '2013'; # declare continue handler for sqlstate '000000' SET @ X2 = 1; declare exit handler for oh_no set @ info = 'violation of primary key const
condition then
Operation
End if;
Case value (optional)
When condition then operation
When condition then operation
End
4. Loop
While condition do... End while
Loop... End loop
Repeat... End repeat
Goto
While... End while example
Create procedure p14 ()
BEGIN
DECLARE v INT;
SET v = 0;
WHILE v
Insert into t VALUES (v );
SET v = v + 1;
End while;
END ;//
Use labels
Lab1: begin
Operation
End lab1;
Lab2: while condition do
# Operation
# Leave lab2 can be used; skip loop
# You can use
:
1) you must declare a cursor before using it. This process does not actually retrieve data. it is only a SELECT statement used by ing Pharmaceuticals.
2) once declared, the cursor must be opened for use. In this process, the data is actually retrieved using the SELECT statement defined earlier.
3) for the cursor with data filled, retrieve the rows as needed
4) the cursor must be closed when the end cursor is used.
24.2 create and use cursor data
After a cursor is opened, you can use the FETCH
Laravel Framework version 5.2.31 Follow the instructions on GitHub, step-by-step configuration, to execute PHP artisan migrate error:
[Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table nam e '' (SQL: alter table `role_user` add constraint `role_user_user_id_foreig n` foreign key (`user_id`) references `` (`id`) on delete cascade on update cas
define conditions and handling procedures
Defining conditions and processing programs is a problem that may occur during program execution. You can also define solutions to these problems in the handler. This method can predict possible problems in advance and propose solutions. In this way, the program's ability to handle problems can be enhanced to avoid abnormal program stop. MySQL uses the DECLARE keyword to define conditions and processing programs. This section describes in detail how to
query condition.
Under example 14-5, query for a record with ID 2 from the Employee table, assigning the d_id value of the record to the variable my_sql. The code is as follows:
SELECT d_id into My_sqlFrom employee Wehre id=2;
14.1.4 define conditions and handlers
Defining conditions and handlers is a predefined problem that you may encounter during the execution of your program. And you can define solutions to these problems in your handlers. This approach can anticipate possible problems
; //Call P20 ();------------------Exception handlingCREATE TABLE T2 (S1 int PRIMARY Key) engine = InnoDB;CREATE TABLE T3 (S1 int primary key references T2 (S1)) engine = InnoDB;A primary key table, and a foreign key tableINSERT into T3 values (5);If prompted: Error 1216 (2300) cannot add or update a child row:a foreign key.is because the main table doesn't have this valueCreate an error log table:CREATE TABLE Error_log (error_message char (100));DELIMITER//CREATE PROCEDURE P22 (parameter1 INT)BE
declare EXIT handler is used to handle exceptions, meaning that if a 1215 error occurs, the program throws a row into the log table. Exit means to exit the compound statement when the action is successfully committed. 1. Syntax for exception handling: 1 DECLARE EXIT | CONTINUE {Error-number| {SQLSTATE error-| MySQL allows two types of processors: Exit and continue, which exits after the error-handling code is executed, and the latter can still conti
) ? 0: (H = key.hashcode ()) ^ (H >>> 16); }//The function that returns the index from the rehashed hashStatic intIndexfor (intHintlength) { returnH (length-1);}To work more efficiently, the size of the internal array must be a power value of 2. Let's take a look at why:Assuming that the length of the array is 17, the mask value is 16 (array length-1). The binary representation of 16 is 0 ... 010000, so for any value H, the result of "H 16" is 16 or 0. This means that an array of length 17
Ora-01000: maximum open cursors exceeded exceptions often occur when you execute the following code:
For (INT I = 0; I {
Prepstmt = conn. preparestatement (SQL [I]);
Prepstmt. setbigdecimal (1, Nb. getrealcost ());
Prepstmt. setstring (2, adclient_id );
Prepstmt. setstring (3, daystr );
Prepstmt. setint (4, comstatic. portalid );
Prepstmt.exe cuteupdate ();
}
1. Check the open_cursors parameter value in the database.Oracle uses the initialization par
1100111, nal_unit_tye = 00111 = 7, so this section is SPs.Another example: 00 00 00 01 68 CE 30 C4 80 00 00 00 00 00 0068 = 01000, nal_unit_tye = 01000 = 8, so this section is PPS.
Forbidden_zero_bit = 0Nal_ref_idc: When the value is not equal to 0, the content of the specified nal unit contains a sequence parameter set, an image parameter set, a reference image band, or a reference image band data segment
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.