34

I am not able to find where to write the stored procedure in phpMyAdmin and how to call it using MVC architecture.

Krishna Mohan
  • 1,503
  • 3
  • 22
  • 28
PHP CODER
  • 1,553
  • 4
  • 17
  • 34

4 Answers4

73

You can easily create procedures in phpMyAdmin.

  1. Go to your database. Click 'Routines' tab in header
  2. Click on 'Add routine'

enter image description here

  1. Then a popup window will be opened. In that write your procedure and click on "GO"

For example like follows. enter image description here

That's it. You can view your created procedures under 'Routines' tab itself.

enter image description here

Krishna Mohan
  • 1,503
  • 3
  • 22
  • 28
42

In phpMyAdmin you can create the stored procedure in the SQL window.

You may have to set the delimieter to something like "$$" instead of the default ";". You can change this from the bottom of the SQL window.

enter image description here

Also you can refer this: http://www.mysqltutorial.org/mysql-stored-procedure-tutorial.aspx

Sathish D
  • 4,854
  • 31
  • 44
  • 4
    You would need Use Call syntax. refer this: http://dev.mysql.com/doc/refman/5.0/en/call.html For example If you have a stored prcedure by name insert_loop, then you would have to use CALL `insert_loop`; – Sathish D Jul 05 '13 at 07:19
5

you can create a stored procedure in the sql query window on the phpmyadmin as you write any other query. And as soon as you execute the SP, it will be stored in the database's information_schema. You can check the existence of SP by the following commands:

SHOW PROCEDURE STATUS
SHOW FUNCTION STATUS

and

SELECT ROUTINE_NAME 
FROM INFORMATION_SCHEMA.ROUTINES 
WHERE 
       ROUTINE_TYPE="PROCEDURE" 
   AND ROUTINE_SCHEMA="dbname"
;
0

STORED PROCEDURES are written using normal SQL language in the SQL box available in phpmyadmin->database->table->execute sql

Refer this: - http://dev.mysql.com/doc/refman/5.0/en/stored-routines.html

digitalextremist
  • 5,952
  • 3
  • 43
  • 62
Tech Consultant
  • 374
  • 1
  • 7