Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: EXECUTE IMMEDIATE ON ORACLE 9i
Something is wrong with your description. Try again and be careful with your typing.
SQL> create table address as select * from test1 where 1=2;
Table created.
SQL> DECLARE
2 NCOUNT NUMBER;
3 drptbl varchar2 (255);
4 BEGIN
5 drptbl := 'DROP TABLE address';
6 SELECT COUNT(*) into NCOUNT FROM USER_TABLES WHERE TABLE_NAME = 'ADDRESS';
7 IF NCOUNT = 1 THEN
8 EXECUTE IMMEDIATE drptbl;
9 END IF;
10 END;
11 /
PL/SQL procedure successfully completed.
SQL>
nickp_at_mmcc.co.uk (nickp) wrote in message news:<81c48a9d.0304110333.64d5affa_at_posting.google.com>...
> I'm trying to run the following code via SQLPLUS on ORACLE9i:
>
> DECLARE
> NCOUNT NUMBER;
> drptbl varchar2 (255);
>
> BEGIN
> drptbl := 'DROP TABLE ADDRESS';
> SELECT COUNT(*) into NCOUNT FROM USER_TABLES WHERE TABLE_NAME = 'ADDRESS';
>
> IF NCOUNT = 1 THEN
> EXECUTE IMMEDIATE drptbl;
> END IF;
>
> END;
>
> AND IT RETURNS THIS ERROR:
>
> EXECUTE IMMEDIATE drptbl;
> *
> ERROR at line 10:
> ORA-06550: line 10, column 14:
> PLS-00103: Encountered the symbol "IMMEDIATE" when expecting one of the following:
> := . ( @ % ;
>
> Does anyone know why this might be ?
>
> Cheers Nick
Received on Fri Apr 11 2003 - 12:37:29 CDT
![]() |
![]() |