All Forums Database
vskaarthi 2 posts Joined 12/15
21 Dec 2015
How to execute a macro within a macro

Hi Guys,
I got a requirement to execute a macro within a macro.
 
Below is the example,
Replace Macro Macro1
(
Log INT,
user_id VARCHAR(10)
)
AS
(
INSERT INTO Table1
SELECT
xx,
xx,
version,
:user_id 
FROM volatile_value as t_bulk

WHERE t_bulk.user_id = :p_user_id;

 

 

-- i am executing mymacro at this stage. i dont know how to get the version from previous select. So that i can parse the version to the below execute statement. There will be always only one value to the version.

 

EXECUTE MYMACRO (version, :p_user_id);

 

 

Tags:
dnoeth 4628 posts Joined 11/04
22 Dec 2015

You can't do this in a macro, you need a Stored Procedure.

Dieter

vskaarthi 2 posts Joined 12/15
23 Dec 2015

Thanks Dieter. Figured that out.
went for a different solution today. 
Join the volatile_value table for "Version" with MYMACRO.
So i wont need version as parameter and wouldnt need a SP as well.
My Macro will only hve user_id as parameter.
hope it works ;-)
 

You must sign in to leave a comment.