top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How we can create a table in PL/SQL block. insert records into it?

0 votes
505 views
How we can create a table in PL/SQL block. insert records into it?
posted Aug 21, 2014 by Selvimohana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

CREATE OR REPLACE PROCEDURE ddl_create_proc (p_table_name IN VARCHAR2)

AS

l_stmt VARCHAR2(200);

BEGIN

DBMS_OUTPUT.put_line('STARTING ');

l_stmt := 'create table '|| p_table_name || ' as (select * from emp )';

execute IMMEDIATE l_stmt;

DBMS_OUTPUT.put_line('end ');

EXCEPTION

WHEN OTHERS THEN

DBMS_OUTPUT.put_line('exception '||SQLERRM || 'message'||sqlcode);

END;

answer Sep 1, 2014 by Rathi
...