hi,
i have a simple problem. I am writing a script to check if a table exists, if so drop it otherwise create it. I have the following where I have decared anumber to be a NUMBER:
When I try to execute the code I get the following error:
Where am I going wrong here?
Thanks
Stephen
i have a simple problem. I am writing a script to check if a table exists, if so drop it otherwise create it. I have the following where I have decared anumber to be a NUMBER:
Code:
IF anumber=1 THEN
DROP TABLE MyTABLE;
ELSE
CREATE TABLE AS SELECT * FROM TABLE2;
END IF;
When I try to execute the code I get the following error:
Code:
ERROR at line 11:
ORA-06550: line 11, column 1:
PLS-00103: Encountered the symbol "DROP" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
<an alternatively-quoted SQL string>
The symbol "lock was inserted before "DROP" to continue.
ORA-06550: line 11, column 44:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. , @ in <an identifier>
<a double-quoted delimited-identifier> partition subpartition
Where am I going wrong here?
Thanks
Stephen