Copy codeThe Code is as follows:
Mysql>
Mysql> delimiter $
Mysql>
Mysql> create procedure myProc ()
-> MODIFIES SQL DATA
-> BEGIN
-> DECLARE l_status VARCHAR (20 );
->
-> CALL myProc1 (l_status );
-> IF l_status = 'duplicate Entry 'THEN
-> Select concat ('Warning: using existing definition for location') AS Warning;
-> End if;
-> END $
Query OK, 0 rows affected (0.00 sec)
Mysql>
Mysql> create procedure myProc1 (OUT out_status VARCHAR (30 ))
-> BEGIN
-> Set out_status = 'duplicate Entry ';
-> END $
Query OK, 0 rows affected (0.00 sec)
Mysql>
Mysql>
Mysql> delimiter;
Mysql> call myProc ();
+ -------------------------------------------------- +
| Warning |
+ -------------------------------------------------- +
| Warning: using existing definition for location |
+ -------------------------------------------------- +
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Mysql> drop procedure myProc;
Query OK, 0 rows affected (0.00 sec)
Mysql> drop procedure myProc1;
Query OK, 0 rows affected (0.00 sec)
Mysql>
Mysql>