Need help in finding (Oracle dynamic Sql with using class) equivalent to Teradata

Database

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:

declare

begin
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..
1 REPLY
Teradata Employee

Re: Need help in finding (Oracle dynamic Sql with using class) equivalent to Teradata

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