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

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -