MySQL Forums
Forum List  »  Stored Procedures

Stored Procedure with Condition
Posted by: david de lorenzo
Date: February 15, 2019 05:04AM

Good morning to everybody.

I have done a procedure with a handler to show a message built by me:

> DELIMITER $$
> CREATE PROCEDURE insert_table(IN name
VARCHAR(10),IN value INT, OUT error VARCHAR(100))
> BEGIN
> DECLARE CONTINUE HANDLER FOR 1452
> BEGIN
> SET error='There are error';
> END;
> SET error='There arenĀ“t error';
> IF name='t2' THEN INSERT INTO t2 VALUES (value);
> ELSEIF name='t3' THEN INSERT INTO t3 VALUES
(value);
> ELSE SELECT 'Not exist the table';
> END IF;
> END$$

Up here fine. Now they ask me to modify it so that it defines a condition in it. Here I lose myself, I have tried several ways to do it without success. Sorry for the inconvenience. I'm a novice in this mysql world.

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored Procedure with Condition
934
February 15, 2019 05:04AM
376
February 15, 2019 09:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.