Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need help with a PL/SQL code

2738620Aug 27 2014 — edited Aug 28 2014

Hi,

I am trying to execute the following PL/SQL code which is resulting in errors, obviously I am not doing it right, but it gives you an idea what I am trying to do :

DECLARE

var_count INT;

SELECT COUNT(*) INTO var_count

FROM sys.all_tables WHERE OWNER = 'SAKILA' AND table_name = 'ACTOR' ;

if var_count > 0 then

BEGIN

DROP TABLE 'ACTOR' ;

END;

/

Erros :

SELECT COUNT(*) INTO var_count

*

ERROR at line 3:

ORA-06550: line 3, column 1:

PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:

begin function pragma procedure subtype type <an identifier>

<a double-quoted delimited-identifier> current cursor delete

exists prior

The symbol "begin" was substituted for "SELECT" to continue.

ORA-06550: line 7, 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> <<

continue close current delete fetch lock insert open rollback

savepoint set sql execute commit forall merge pipe purge

Your assistance in creating it in a right way will be appreciated.

Many thanks.

Tonya.

This post has been answered by Billy Verreynne on Aug 28 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2014
Added on Aug 27 2014
12 comments
2,573 views