Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PLS-00103 caused by PL SQL Declare keyword

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading