Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The MySQL "DELIMITER" keyword isn't working

Ok so, I've been ripping my hairs ou on this one, why doesn't this work?

DELIMITER |

CREATE PROCEDURE Decrypt_pw()
    READS SQL DATA
BEGIN
  SELECT 'Hey Select';
END|

It's so basic and I'm pretty sure I'm using the correct syntax, what am I missing?

Error:

21:14:07  [DELIMITER - 0 row(s), 0.000 secs]  [Error Code: 1064, SQL State: 42000]  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER |

CREATE PROCEDURE Decrypt_pw()
    READS SQL DATA
BEGIN
  SELECT 'He' at line 1
 21:14:07  [END| - 0 row(s), 0.000 secs]  [Error Code: 1064, SQL State: 42000]  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END|' at line 1

I'm using DbVisualizer, latest version, could this problem be with the software itself?

Perhaps I should explain myself better, the passwords are encrypted in my database (no need to worry), and this allows me to decrypt them, this is for a personal project I'm working on.

I was trying to develop a script that would allow me to run it and set up the necessary databases, tables, etc for that to work, and I require some SPs which must also be created, I'm trying to create an SP through a mysqli_query, is that even possible?

Basically it's for a "setup script" of a php application.

UPDATE: Seems that this is supposed to work, however I can't use objects due to the guys at HostGator -.- not allowing for objects in PHP.

I Have pretty much given up on mysqli since it's just not going to work I'm trying with shell_exec, I'm creating the procedure but when I check the ddl it's empty, it's creating empty procedures but at least it's doing something...

like image 265
Pedro 'Xympa' Nascimento Avatar asked Jul 02 '12 20:07

Pedro 'Xympa' Nascimento


People also ask

What is delimiter command in MySQL?

A MySQL client program such as MySQL Workbench or mysql program uses the delimiter ( ; ) to separate statements and executes each statement separately. However, a stored procedure consists of multiple statements separated by a semicolon (;).

What does delimiter $$ do?

Delimiters are used when we need to define the stored procedures as well as to create triggers. Default delimiter is semicolon. Step 1: Create and insert a value in a database. But, if we are considering multiple statements, then we need to use different delimiters like $$ or //.

What is $$ in MySQL?

In MySQL query, what does the $$ signify? DELIMITER $$ CREATE TRIGGER before_population_update BEFORE UPDATE ON City FOR EACH ROW BEGIN INSERT INTO City_Changes SET ACTION = 'update', CityID = OLD.ID, Population = OLD.

What does Delimeter mean in SQL?

A delimiter is a simple or compound symbol that has a special meaning to PL/SQL. For example, you use delimiters to represent arithmetic operations such as addition and subtraction. Symbol.


1 Answers

it is probaly a software version problem... i tried your code and it works just fine for me... try this

DELIMITER //
    CREATE PROCEDURE Decrypt_pw()
            READS SQL DATA
      BEGIN
      SELECT 'Hey Select';
      END //
    DELIMITER ;
like image 121
gui_s3 Avatar answered Nov 29 '22 00:11

gui_s3