Re: Questions To Ask Before You Opt For Oracle Directory Services
Posted by: desi hilina
Date: January 22, 2014 06:02AM

Hi,
Tell me if its possible to call a stored procedure from another mysql database say database A which has procedure spA, be called to database B?.
This is what i have: A stored procedure called createtables that creates in database A. I need the same procedure to create tables in databases B,C,D....
Another problem is that you cannot include USE DATABASE X within a stored procedure. Please help

Procedure to create database here:
DROP PROCEDURE IF EXISTS createdatabase $$
CREATE DEFINER=`root`@`localhost` PROCEDURE createdatabase(IN db VARCHAR(60))
BEGIN

SET @db_name = db;
SET @stmt = CONCAT('create database ',@db_name);
PREPARE stmt1 FROM @stmt;
EXECUTE stmt1;

END $$

DELIMITER ;


and procedure to create table here:

delimiter |
drop procedure if exists createtablemasterDB |
create procedure createtablemasterDB()
begin
create table masterstock (stockid int(10) not null auto_increment,stockname varchar(30),stockdescription text,transactiondate date,createdate timestamp,userid varchar(50),primary key(stockid));
create table mastercategory(categoryid varchar(20),categoryname varchar(30),categorydescription text,transactiondate date,createdate timestamp,userid varchar(50),stockid int(10),primary key(categoryid));

end |
delimiter ;

Options: ReplyQuote


Subject
Written By
Posted
Re: Questions To Ask Before You Opt For Oracle Directory Services
January 22, 2014 06:02AM
January 23, 2014 12:19AM


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.