PLS-00103由PL SQL Declare关键字引起。

huangapple go评论67阅读模式
英文:

PLS-00103 caused by PL SQL Declare keyword

问题

I am learning PL SQL and running the below code --

创建或替换过程 PROCEDURE1 AS

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

END PROCEDURE1;

However, this is giving an error like below ==

错误(3,1):PLS-00103:遇到符号"DECLARE"时,期望以下之一:begin function pragma procedure subtype type current cursor delete exists prior external language

有什么帮助可以解释为什么出现此错误以及如何解决它?

英文:

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?

答案1

得分: 0

"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;
"

英文:

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;

huangapple
  • 本文由 发表于 2023年4月17日 21:00:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76035425.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定