Mysql SQL stored procedure condition definition and processing. The condition definition and processing of the stored procedure can define the problems encountered during the processing for corresponding processing.
Definition and processing of Stored Procedure ConditionsYou can define the problems encountered during the processing and handle them accordingly.
I. condition definition
DECLARE condition_name condition for condition_vale
Condition_value:
Sqlsta
MySQL uses multiple statements in the Exception Handling Section of the stored procedure-- Create a test table without any dataDrop table if exists t;Create table t (id int );-- Create a stored procedureDrop procedure if exists test;Delimiter |Create procedure test ()BeginDeclare vId int;-- Cursor, no data result setDeclare cTest cursor for select * from t;-- Use begin and end to execute multiple commands in case of an exceptionDeclare continue handler for s
{Code ...} the above is the verification rule {code ...} check whether the markets Table Name of the database mysql_card exists. Unfortunately, the following error is returned when writing this id. {code ...} there is no unique: mysql_card.operators, phoneunique this...
public function rules(){ return [ 'phone' => 'required|digits_between:10,12|unique:mysql_card.operators,phone', 'name' => 'required', 'market_id' => 'required|exists:mysql_card
I executed {code ...} error {code ...} I found the information online, right. env and database. PHP file configuration is correct {code ...} the following configuration is modified as follows: 127.0.0.10.0.0.0 is invalid {code ...} in addition, this command is invalid {code ...} execute
php artisan migrate
Error
[PDOException] SQLSTATE[HY000] [2002] No such file or directory
I searched for information online.envAnddatabase.phpFile configuration is n
()! = '000000 '){Print_r ($ db-> errorInfo ());Exit;}$ Arr = $ rs-> fetchAll ();Print_r ($ arr );$ Db = null;?> The PDO and PDOStatement objects have the errorCode () and errorInfo () methods. If there are no errors, errorCode () returns: 00000. Otherwise, some error codes are returned. An array returned by errorInfo (), including the PHP-defined error code and MySQL error code and error information. The array structure is as follows:Array([0] => 42S22[1] => 1054.[2] => Unknown column 'aaa' in
successful,
4: Connection test:
Note that the connection here is not with Mssql_connect but with Sqlsrv_connect, and in this version there are several functions:This extension provides PHP with a new set of functions that begin with sqlsrv_, which are commonly used as follows:
Sqlsrv_connect sqlsrv_close sqlsrv_commit sqlsrv_errors sqlsrv_fetch Sqlsrv_fetch_array Sqlsrv_fetch_metadata sqlsrv_num_rows sqlsrv_query sqlsrv_rollback sqlsrv_rows_affected ... Also note that if you use
MySql official manual Study Notes 3-MySql stored procedure introduction bitsCN.com
SELECT
Create procedure sp1 (x VARCHAR (5 ))//Create storage process
BEGIN
DECLARE xname VARCHAR (5) DEFAULT 'Bob ';//Declare local variables
DECLARE newname VARCHAR (5 );
DECLARE xid INT;
SELECT xname, id INTO newname, xid//Store the property value to the variable.
FROM table1 WHERE xname = xname;
SELECT newname;
END;
The variable name cannot be the same as the column name. when this program is called, regardle
tp3.2.3 database Configuration ' db_charset ' = ' utf8mb4 ' to perform an error. As follows
SQLSTATE[HY000] [2019] Can ' t initialize character set UTF8MB4 (path:/usr/share/mysql/charsets/) error location file:/data1/www/ htdocs/733/ecampus/3/thinkphp/library/think/db/driver.class.php line:109
If no TP is used, the native SQL ' Set names UTF8MB4 ' execution is no problem.What went wrong to solve! Thank you!
Reply content:
tp3.2.3 database Configu
Laravel run error under MySQL5.1, error is as follows:
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ''1'' for column 'status' at row 1 (SQL: insert into `cases` (`case_name`, `status`, `updated_at`, `created_at`) values ('fdsafdsadsa', '1', 1474504956, 1474504956))
But I wrote the PDO to perform the test without a problem
try { $sth = $db->prepare('insert into cases(case_name,status,updated_at,created_at) values (?,?,?,?)'); $st
series of functions starting with sqlsrv _ to php, which are commonly used as follows:
Sqlsrv_connectSqlsrv_closeSqlsrv_commitSqlsrv_errorsSqlsrv_fetchSqlsrv_fetch_arraySqlsrv_fetch_metadataSqlsrv_num_rowsSqlsrv_querySqlsrv_rollbackSqlsrv_rows_affected...In addition, if you use this extension to connect to SQL server 2005 and later versions of SQL server (such as SQL server 2008), you also need to install SQL Server Native Client on the machine first.Otherwise, the following error occurs:
Array
Laravel runs in MySQL5.1 with the following error: {code ...} but there is no problem with executing the test on the PDO written by myself. {code ...} data table structure: it was also found on the Internet that the SQL _MODE has been changed, and the error is still reported. The problem is solved by adding Shell filter...
Laravel runs in MySQL5.1 with the following error:
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ''1'' for column
What should I do if an error occurs when setting the db2 primary key? The following describes how to solve the problem of not allowing you to set the db2 primary key. We hope this will help you learn how to set the db2 primary key.
Set empno as the primary key
Db2 => alter table emp add primary key (empno)
DB21034E The command was processed as an SQL statement because it was not
Valid Command Line Processor command. During SQL processing it returned:
SQL0542N "EMPNO" cannot be a column of a prim
statement is ignored and not processed. In theory, if you believe that the data from EM. SALARY> MA. SALARY does not exist, if yes, it means there is a problem. What should you do if you want to throw an exception? As follows:
MERGE INTO EMPLOYE AS EMUSING MANAGER AS MAOn em. EMPLOYEID = MA. MANAGERIDWhen matched and em. SALARY When matched and em. SALARY> MA. salary then signal sqlstate '000000' SET MESSAGE_TEXT = 'em. SALARY> MA. SALARY'When not ma
Some problems may occur when you connect to the database during the use of DB2. This article gives you a detailed explanation of the two solutions for your reference. I hope this will be helpful.
1. solutions to several SQL1032N errors in DB2
The error SQL1032N has been reported several times since DB2 was used. The error message is as follows:11/21/2004 22:15:33 0 0 sql1_2c an unexpected system error occurred.SQL1032N does not issue the command to start the Database Manager.
The following articles mainly tell you about the DB2 User Password modification and database backup and recovery issues, the following describes the actual operation code used in the DB2 User Password modification and Database Backup recovery operations.
The day before yesterday, I started to install the provincial total server, first set up the database, and then installed the package program. Everything went step by step and went smoothly. But at last, the program was always unable to connect
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 con
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.