0

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:

create or replace procedure delgroup
(g_id in number)

is

begin

DELETE FROM grouptable WHERE GROUP_ID=g_id;

commit;
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 :)

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Atli
0

Hey.

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

In your case it would look something like this:

DROP PROCEDURE IF EXISTS `delgroup`;
DELIMITER //
CREATE PROCEDURE `delgroup`(g_id Int)
BEGIN
    DELETE FROM grouptable WHERE GROUP_ID=g_id;
END//
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.

Edited by Atli: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.