note 113003 added to mysqli.multi-query
| From: | keksov at gmail dot com | Date: | Sat, 17 Aug 2013 06:29:22 +0000 |
| Subject: | note 113003 added to mysqli.multi-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196004@lists.php.net to get a copy of this message | ||
If you want to create a table with triggers, procedures or functions in one multiline query you may
stuck with a error -
#1064 - You have an error in your SQL syntax; xxx corresponds to your MySQL server version for the
right syntax to use near 'DELIMITER' at line 1
The solution is very simple - don't use DELIMITER keyword at all! So, instead of :
DELIMITER |
CREATE TRIGGER $dbName.$iname BEFORE INSERT ON $table FOR EACH ROW
BEGIN
<body>
EOT|
DELIMITER ;
just use :
CREATE TRIGGER $dbName.$iname BEFORE INSERT ON $table FOR EACH ROW
BEGIN
<body>
EOT;
For more information read answers at StackOverflow for question #5311141
http://stackoverflow.com/questions/5311141/how-to-execute-mysql-command-delimiter
----
Server IP: 69.147.83.199
Probable Submitter: 89.191.241.236
----
Manual Page -- http://php.net/manual/en/mysqli.multi-query.php
Edit -- https://master.php.net/note/edit/113003
Del: integrated -- https://master.php.net/note/delete/113003/integrated
Del: useless -- https://master.php.net/note/delete/113003/useless
Del: bad code -- https://master.php.net/note/delete/113003/bad+code
Del: spam -- https://master.php.net/note/delete/113003/spam
Del: non-english -- https://master.php.net/note/delete/113003/non-english
Del: in docs -- https://master.php.net/note/delete/113003/in+docs
Del: other reasons-- https://master.php.net/note/delete/113003
Reject -- https://master.php.net/note/reject/113003
Search -- https://master.php.net/manage/user-notes.php