nikhilesh_chawla
asked on
creating table dynamically in oracle
Hi,
I have a PL/SQL block like below:
declare
v_char_date varchar2(20);
begin
v_char_date := to_char(sysdate, 'DDMONYYYYHH24MISS');
execute immediate 'create table v_char_date(col_name varchar2(20))';
end;
I want to create a table with name whatever i get in v_char_date variable.
But a table gets created with name "v_char_date".
Please help how to do that....
I have a PL/SQL block like below:
declare
v_char_date varchar2(20);
begin
v_char_date := to_char(sysdate, 'DDMONYYYYHH24MISS');
execute immediate 'create table v_char_date(col_name varchar2(20))';
end;
I want to create a table with name whatever i get in v_char_date variable.
But a table gets created with name "v_char_date".
Please help how to do that....
ASKER
No. It's not working.
Please try before answering.
Please try before answering.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
v_char_date varchar2(20);
begin
v_char_date := to_char(sysdate, 'DDMONYYYYHH24MISS');
execute immediate 'create table ' + v_char_date + '(col_name varchar2(20))';
end;