Dynamic SQL in PLSQL
In PL/SQL the SQL statement is created as a string, which is then executed using the EXECUTE IMMEDIATE clause
declare
v_techhards varchar2(2000);
begin
v_techhards varchar2(2000);
begin
for r_techhards in (select * from user_tables) loop
v_techhards:= 'delete '||r_techhards.table_name;
dbms_output.put_line(v_techhards);
execute immediate v_techhards;
end loop;
end;
/
=========================================================================
#Oracle SQL#Oracle PLSQL#Oracle Apps#Oracle Database#SQL #Query #Dynamic SQL #execute immediate #Oracle dynamic DDL
No comments:
Post a Comment