Teradata calling procedure within a procedure


Teradata calling procedure within a procedure

Does teradata allows calling procedure in a procedure. Actually i want to use statement CALL DBC.SysExecSQL('CALL DBC.SysExecSQL(:CS_SQL_Text);'); in a procedure . Also do remember that :CS_SQL_TEXT contains a dynamic sql. And what if the inner procedure returns no rows. Does the main procedure will fail ? . Actually i wanted to create a procuedure that will first run a dynamic sql statement. stores its result and then execute the set of statements in that procedure. It would be of great if anyone can help me in fnding a solution.


Re: Teradata calling procedure within a procedure

The procedures can be called within the body of other procedures.

But I don't think you can achieve what you are trying to do by nesting the SYSEXECSQL calls. The procedure expects a SQL in the parameter and executes it. Though there are some limitations to the operations that can be performed in the dynamic SQL, like you can't execute SELECT statement etc., which I believe you are already aware of.

CALL is a PL/SQL statement and it won't be supported in as the parameter of SYSEXECSQL!