sql - IF-Exists not working in Oracle for a query -
whats's wrong query giving me error:
declare con integer; begin select count(*)as result con user_tables table_name ='txn_temp_table'; if( con = 1 ) begin drop table txn_temp_table1; end; end if; end;
i'm trying drop table if exists query throwing errors.
you can use execute immediate
execute ddl:
declare con integer; begin select count(*) con user_tables table_name ='txn_temp_table'; if con = 1 execute immediate 'drop table txn_temp_table'; end if; end;
Comments
Post a Comment