Breaking News

Editors Picks

Tuesday, December 6, 2011

drop table if exists in oracle sql


declare tbl_exist number;
   BEGIN
        select count(*) into tbl_exist from user_tables where Upper(table_name)=Upper('test1');
        DBMS_OUTPUT.put_line(tbl_exist);
        if tbl_exist = 1 then
           EXECUTE IMMEDIATE 'drop table test1';
        end if;
   end;

No comments :

Post a Comment

Contact Us

Name

Email *

Message *