All Forums Database
valli4u.n 1 post Joined 11/08
26 Nov 2008
Need help in finding (Oracle dynamic Sql with using class) equivalent to Teradata

Is there any way to use bind variables in Teradata stored Procedure with dynamic Sql,Actually my requiremet is like this,i Have an Oracle procedure which contains an update stmt with Dynamic sql and using clause,can anyone please give me some information regarding this..it is an urgent reuirement,need ur valueable inputs for to find a way to this..Example:declarebegin execute immediate 'insert into dept values (:1, :2, :3)' using 50, l_depnam, l_loc; commit;end;Note: In my case the using clause variables are not declared in the declaration part,they were used as bind variables..the same how we can implement in Teradata...Thanks in Advance....waiting for ur inputs..

Adeel Chaudhry 773 posts Joined 04/08
26 Nov 2008

Hello,Well, for dynamic-sql in stored-procedures, you can use:CALL DBC.ExecSQL('your sql here');In your example, it will be translated to:CALL DBC.ExecSQL('INSERT dept VALUES (' || CAST(50 AS VARCHAR(3)) || ', ' || CAST(l_depnam AS VARCHAR(10)) || ', ' || CAST(l_loc AS VARCHAR(10)) || ');');HTH.Regards,Adeel

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.