PLS-00103 caused by PL SQL Declare keyword

Advertisements

I am learning PL SQL and running the below code —

 create or replace PROCEDURE PROCEDURE1 AS 

DECLARE
  c VARCHAR2(60 CHAR);
BEGIN
  c := 'abc  ';
END;



END PROCEDURE1;

However, this is giving error like below ==

Error(3,1): PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following: begin function pragma procedure subtype type current cursor delete exists prior external language

Any help why this error is coming and how this can be removed?

>Solution :

It’s not "paste a working anonymous block between "create" and "end". In a procedure the DECLARE and END statement are not needed. The CREATE PROCEDURE will service as DECLARE and the END [PROCEDURE_NAME]; serves as end. Google "Oracle create procedure syntax" for more info.

create or replace PROCEDURE PROCEDURE1 AS 
  c VARCHAR2(60 CHAR);
BEGIN
  c := 'abc  ';
END PROCEDURE1;

Leave a ReplyCancel reply