MySQL Forums
Forum List  »  Stored Procedures

INSERT INTO EXEC
Posted by: Marc Schneider
Date: November 16, 2005 03:39AM

In SqlServer i have a meta database `MyBase` who consolid n databases `Base_i`
In each `Base_i` i have procedures like :

CREATE PROCEDURE myProc
@i int
AS
SELECT * FROM myTable WHERE (MyColumn < @i)
GO

But More complex of course and different in each `Base_i` !
For the consolidation i load this proc in each `Base_i` like :

CREATE PROCEDURE consolid
AS
DECLARE @isAProc varchar(150)
CREATE TABLE #myTemporary(
.....
)

-- for each `Base_i`
SET @isAProc = 'Base_i' + '..myProc'
INSERT INTO #myTemporary EXEC (@isAProc )
--end for each

INSERT INTO the_real_consolid_table SELECT * FROM #myTemporary WHERE ...
GO

In MySql 5.0.15 i can't do this ?
I try this ways in
SET @leExec = CONCAT('INSERT INTO `myTemporary`, .....);
PREPARE stm_str_sql FROM @leExec;
EXECUTE stm_str_sql;
DEALLOCATE PREPARE stm_str_sql;
but this is not good:
INSERT INTO `myTemporary` CALL
INSERT INTO `myTemporary` SELECT CALL

Then i try to do a function that RETURNS TABLE
it's not possible

How can i do my consolid whith out rewrite all procedures of `Base_i` in `MyBase`?

Options: ReplyQuote


Subject
Views
Written By
Posted
INSERT INTO EXEC
2945
November 16, 2005 03:39AM
1784
November 16, 2005 04:59AM
1815
November 17, 2005 02:34AM
1889
November 17, 2005 03:05AM
1801
November 18, 2005 02:39AM
1994
November 18, 2005 06:08AM
1991
November 21, 2005 08:01AM
1772
November 21, 2005 08:14AM
1916
November 18, 2005 02:53AM
2004
November 22, 2005 01:59AM
1836
November 22, 2005 02:20AM
2123
November 22, 2005 06:21PM


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.