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
2958
November 16, 2005 03:39AM
1790
November 16, 2005 04:59AM
1823
November 17, 2005 02:34AM
1895
November 17, 2005 03:05AM
1809
November 18, 2005 02:39AM
2002
November 18, 2005 06:08AM
1999
November 21, 2005 08:01AM
1777
November 21, 2005 08:14AM
1926
November 18, 2005 02:53AM
2008
November 22, 2005 01:59AM
1842
November 22, 2005 02:20AM
2131
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.