Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute triggers stored procedures on SqlFiddle. Mysql

Does SQL-fiddle facilitate execution of triggers/stored procedures?

I have been unable to execute even the simplest form of stored procedure on sqlfiddle

DELIMITER $$
DROP PROCEDURE IF EXISTS myProc $$

CREATE PROCEDURE myProc()
BEGIN

END$$
DELIMITER ;

Sqlfiddle does not allow executing this(above) sql in build schema, but allows create table etc

Note: The same syntax is working for me on my localhost using wamp with mysql 5.5.24

Can anyone guide please?

like image 704
Sami Avatar asked Aug 28 '12 19:08

Sami


People also ask

Can a trigger execute a stored procedure?

A: Yes, we can call stored procedure inside the trigger.

How do you call a stored procedure from a trigger in MySQL?

MySQL allows you to call a stored procedure from a trigger by using the CALL statement. By doing this, you can reuse the same stored procedure in several triggers. However, the trigger cannot call a stored procedure that has OUT or INOUT parameters or a stored procedure that uses dynamic SQL.

How do I execute a procedure in MySQL?

Create a simple stored procedure. DELIMITER ; To create the MySQL Stored Procedure, open the MySQL workbench Connect to the MySQL Database copy-paste the code in the query editor window click on Execute. You can view the procedure under stored procedures.

How do I trigger a stored procedure in SQL server?

In Object Explorer, connect to an instance of the SQL Server Database Engine, expand that instance, and then expand Databases. Expand the database that you want, expand Programmability, and then expand Stored Procedures. Right-click the user-defined stored procedure that you want and select Execute Stored Procedure.


1 Answers

Instead of using the delimiter option (which is not a real SQL statement, but rather only a command for the mysql command prompt) use the "Query Terminator" option on SQL Fiddle to establish your delimiter.

For example:

http://sqlfiddle.com/#!2/88fcf

Note the // dropdown below the schema box? That's the SQL Fiddle equivalent to the mysql DELIMITER command.

Longer example with queries in the stored procedure (note that within the stored procedure, ; is still used as a delimiter):

http://sqlfiddle.com/#!9/4db78

Full disclosure: I'm the author of SQL Fiddle.

like image 82
Jake Feasel Avatar answered Oct 16 '22 18:10

Jake Feasel