944,129 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 531
  • MySQL RSS
Nov 1st, 2009
0

Stored Procedures Help please

Expand Post »
I have made stored procedures in Oracle...but need to export them to mysql. I have searched on google but cant figure out the syntax.

Here is the oracle procedure:


sql Syntax (Toggle Plain Text)
  1. CREATE OR REPLACE procedure delgroup
  2. (g_id IN number)
  3.  
  4. IS
  5.  
  6. BEGIN
  7.  
  8. DELETE FROM grouptable WHERE GROUP_ID=g_id;
  9.  
  10. COMMIT;
  11. END;


I jus basically want to delete the group from the group table..depending on which group id (the arguement) the user types in.

How would i do this exact same procedure in mysql?

Please some assistance guys
Last edited by peter_budo; Nov 1st, 2009 at 4:39 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
badmanmc is offline Offline
4 posts
since Oct 2009
Nov 1st, 2009
0
Re: Stored Procedures Help please
Hey.

You can see how MySQL procedures look like in the manual.

In your case it would look something like this:
sql Syntax (Toggle Plain Text)
  1. DROP PROCEDURE IF EXISTS `delgroup`;
  2. DELIMITER //
  3. CREATE PROCEDURE `delgroup`(g_id INT)
  4. BEGIN
  5. DELETE FROM grouptable WHERE GROUP_ID=g_id;
  6. END//
  7. DELIMITER ;
Note, the DELIMITER commands and the trailing // on END are only required if you are running this through the MySQL CLI, or other such interfaces.
Last edited by Atli; Nov 1st, 2009 at 1:01 pm.
Reputation Points: 93
Solved Threads: 70
Posting Pro
Atli is offline Offline
526 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: MySQL Query - Searching for multiple keywords
Next Thread in MySQL Forum Timeline: SET datatype





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC