Posted: Tue Apr 03, 2007 10:05 pm Post subject: Need to Call a Procedure dynamically using EVAL
Novice
Joined: 15 Jun 2006 Posts: 21
I have a requirement where i will be getting the procedure name(which should be invoked) in a input file. I need to call that procedure which is coming from input. so i need to achieve dynamic action.
Ex: set procname=InputRoot.XML.Employee.Procname;
here sample is the broker schema name. under this schema my procedures have been defined.
inputref is the reference pointing to inputroot
outputref is the reference pointing to outputroot.
This is my procedure code:
--------------------
BROKER SCHEMA sample
CREATE PROCEDURE ProcessInput(IN inputRef REFERENCE,INOUT outputref REFERENCE)
BEGIN
SET outputref.XML.Student.SNO = inputRef.XML.Employee.ENO;
END;
-------------------------
This is my control flow code
-------------------------------------
PATH sample;
CREATE COMPUTE MODULE RefProc_MsgFlow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
CREATE LASTCHILD OF OutputRoot DOMAIN 'XML' NAME 'XML';
DECLARE inputRef REFERENCE TO InputRoot;
DECLARE outputref REFERENCE TO OutputRoot;
DECLARE procname CHARACTER;
SET procname=inputRef.XML.Employee.PROCNAME;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER;
DECLARE J INTEGER;
SET I = 1;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum