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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -