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?
A: Yes, we can call stored procedure inside the trigger.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With