Thursday 15 March 2012

How to create a table inside a stored procedure


Create Table Script Inside the Procedure in Oracle 


Sample Script 1 : 


CREATE OR REPLACE PROCEDURE prc_create_table
AS
v_ddl 
VARCHAR2 (100); 
BEGIN
v_ddl := 'CREATE TABLE temp_test(a number, b varchar2(10))'; 
EXECUTE IMMEDIATE v_ddl; 
END


for Test Case...........


Begin
    prc_create_table ();
End;


Sample Script 2 :  
  
Sample 2 :

create or replace procedure create_table as
begin
       execute immediate 'create table mytable (id integer )';
end ;


for Test Case........... 




Begin
create_table ();
End;

No comments:

Post a Comment