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
We have a job on the database server in the past few days occasionally encountered the following error (sensitive information has been processed), mainly reported "TCP provider:the semaphore timeout period has expired. [SQLSTATE 07008] (Error 121) OLE DB Provider "SQLNCLI" for linked server "(NULL)" returned message "Communication link failure". [SQLSTATE 01000] (Error 7412). The step failed. The stored pro
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
Now, the company replicates data from a single server. Now we know that you need to install multiple mysql services. Now, under the existing single-instance database, different ports are divided into the red section below;[Root @ mysql ~] # Netstat-tunlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nameTcp 0 0 0.0.0.0: 1001 0.0.0.0: * LISTEN 2515/rpc. statdTcp 0 0 0.0.0.0: 111 0.0.0.0: * LISTEN 2483/portmapTcp 0 0 127.0.0.1: 631 0.0
Tags: nstat doc active structure delete DMI blank port-668DB2 Database Execution Insert INSERT statement 57016 Error (table inactive)Reason: 1. The table structure has been modified.2. The primary key is removed. Or the primary key has been modified.If you are using the console, you can use theREORG table name;If you use the tool to execute the above statement and then a 42601 error, you can try the following statementExample: Call Sysproc. Admin_cmd
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.