Execute Immediate in Oracle Reports 11g

Using the EXECUTE IMMEDIATE command directly in Reports is not possible, but you can work around this by creating a stored procedure in the database and then using this procedure in Reports. 

The database stored procedure can be created as follows: 
CREATE OR REPLACE PROCEDURE DYNAMIC_SQL(STMNT char) IS 
begin 
     BEGIN 
         EXECUTE IM
MEDIATE stmnt; 
     exception 
         when others then 
             dbms_output.put_
line('hello'); 
     end; 
end;
 

Now, this procedure can be called in Reports. 
For example: 
In the BeforeParam Trigger, the Procedure can be called as: 
DYNAMIC_SQL('drop table TEST'); 
This will drop the table 'TEST' from the database.

No comments:

Post a Comment

Please Provide your feedback here