Link to home
Start Free TrialLog in
Avatar of nikhilesh_chawla
nikhilesh_chawlaFlag for India

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....
Avatar of orcic
orcic

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;
Avatar of nikhilesh_chawla

ASKER

No. It's not working.
Please try before answering.
ASKER CERTIFIED SOLUTION
Avatar of orcic
orcic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial