MySQL Forums
Forum List  »  Stored Procedures

Re: Get the schema name from inside a stored-procedure
Posted by: Rick James
Date: July 19, 2014 12:16PM

Do you actually have a problem? (Or is my test case flawed?)

mysql> use try;
Database changed

mysql> create table f617674 (x int);
Query OK, 0 rows affected (0.06 sec)

mysql> delimiter //
mysql> create procedure p617674 (arg int)
    -> begin
    -> insert into f617674 (x) VALUE (arg);
    -> end;
    -> //
Query OK, 0 rows affected (0.06 sec)

mysql> delimiter ;
-- ---------------------------
mysql> use test;
Database changed
mysql> create table f617674 (x int);
Query OK, 0 rows affected (0.05 sec)

mysql> delimiter //
mysql> create procedure p617674 (arg int)
    -> begin
    -> insert into f617674 (x) VALUE (arg);
    -> end;
    -> //
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;
-- ---------------------------

mysql> use try;
Database changed

mysql> call test.p617674(1234);
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM  try.f617674;
Empty set (0.00 sec)

mysql> SELECT * FROM test.f617674; -- want insert to show here
+------+
| x    |
+------+
| 1234 |
+------+
1 row in set (0.00 sec)

If you want to edit/run that test case, here it is:
use try;
create table f617674 (x int);
delimiter //
create procedure p617674 (arg int)
begin
insert into f617674 (x) VALUE (arg);
end;
//
delimiter ;
-- ---------------------------

use test;
create table f617674 (x int);
delimiter //
create procedure p617674 (arg int)
begin
insert into f617674 (x) VALUE (arg);
end;
//
delimiter ;
-- ---------------------------

use try;
call test.p617674(1234);

SELECT * FROM  try.f617674;
SELECT * FROM test.f617674; -- want insert to show here

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Get the schema name from inside a stored-procedure
1830
July 19, 2014 12:16PM


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.