PLS-00103: Encountered the symbol "ALTER"
719742Sep 7 2011 — edited Sep 7 2011I am getting he following error when I run this script
DECLARE
vcount NUMBER(1);
BEGIN
SELECT count(*) INTO vcount FROM all_col_comments
WHERE Owner = 'myUser' and Table_Name = 'table1' and column_name = 'col1';
IF vcount = 0 THEN
ALTER TABLE myUser.table1
ADD (col1 varchar2(1) DEFAULT 'N' NOT NULL);
END IF
END;
Error report:
ORA-06550: line 7, column 4:
PLS-00103: Encountered the symbol "ALTER" 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
The symbol "lock was inserted before "ALTER" to continue.
ORA-06550: line 8, column 11:
PLS-00103: Encountered the symbol "(" when expecting one of the following:
, in
ORA-06550: line 8, column 47:
PLS-00103: Encountered the symbol "NULL" when expecting one of the following:
in like like2 like4 likec between member submultiset
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.