Thursday, 12 February 2015

Oracle if table not exist create or Delete


declare
   c int;
begin
   select count(*) into c from user_tables where table_name = upper('table1');
   if c = 1 then
      execute immediate 'drop table table1';
   end if;
   execute immediate 'CREATE table table1 (pkey NUMBER)';
end;

Kindly Bookmark and Share it:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...