执行存储过程时出现 Oracle 未知命令错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5706364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 23:23:01  来源:igfitidea点击:

Oracle Uknown Command Error when executing stored proc

sqloraclestored-procedures

提问by kralco626

I am using SQl Developer to execute a procedure with in a package named CONTRACTOR_REG. The procedure has the following signiture.

我正在使用 SQL Developer 在名为 CONTRACTOR_REG 的包中执行一个过程。该过程具有以下特征。

PROCEDURE usp_ins_contractor_all(
          webid          VARCHAR2,--
          firstname      VARCHAR2,--
          lastname       VARCHAR2,--
          middlename     VARCHAR2,--
          busname        VARCHAR2,--
          townname       VARCHAR2,--
          strname        VARCHAR2,--
          strtypecd      VARCHAR2,--
          strpfxcd       VARCHAR2,--
          strsfxcd       VARCHAR2,--
          addressoverflo VARCHAR2,--
          houseno        VARCHAR2,--
          zipcd          VARCHAR2,--
          state          VARCHAR2,--
          phonenum       VARCHAR2,--
          phonenight     VARCHAR2,
          phonecell      VARCHAR2,--
          phonefax       VARCHAR2,--
          phonepager     VARCHAR2,
          licno          VARCHAR2,--
          regSite        VARCHAR2,
          licstate       VARCHAR2,--
          level_type     VARCHAR2 := 'NA',--
          type_cd        CHAR)

I am trying to execute the following:

我正在尝试执行以下操作:

exec user1.contractor_reg.usp_ins_contractor_all('testing12345',
          'test',
          'me',
          'a',
          'testbiz',
          'DFGGH',
          'something',
          null,
          null,
          null,
          'pobox:12345',
          '45',
          '00000',
          'DF',
          '1231231231',
          '2342342344',
          '443243242',
          '111111111',
          null,
          '123123123',
          null,
          'FD',
          'NA',
          'EC')

I get following error:

我收到以下错误:

Error starting at line 25 in command:
          'EC')
Error report:
Unknown Command

Seems really random to me, whats wrong with my last parameter?

对我来说似乎很随机,我的最后一个参数有什么问题?

Thanks in advance!

提前致谢!

回答by Rajesh Chamarthi

The reason mentioned in your reply might not be the reason for the error.

您回复中提到的原因可能不是错误的原因。

As Alex mentioned below, to use EXEC with SQLPLUS, you need use the continuation character, if your command spans multiple lines...

正如下面提到的亚历克斯,要将 EXEC 与 SQLPLUS 一起使用,如果您的命令跨越多行,则需要使用继续符...

http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12022.htm#i2697931

http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12022.htm#i2697931

EXEC is a SQLPLUS command. when you use..

EXEC 是一个 SQLPLUS 命令。当你使用..

exec p1;

in sqlplus,it in turn adds a begin and end block to execute your procedure...

在 sqlplus 中,它依次添加了一个开始和结束块来执行您的过程......

begin
  p1;
end;
/

Not sure if SQL Developer supports this.I don't have access to SQL Developer at work, but..

不确定 SQL Developer 是否支持此功能。我在工作中无法访问 SQL Developer,但是..

Have you tried executing this procedure using BEGIN-END ?

您是否尝试过使用 BEGIN-END 执行此过程?

begin
  user1.contractor_reg.usp_ins_contractor_all('testing12345',
          'test',
          'me',
          'a',
          'testbiz',
          'DFGGH',
          'something',
          null,
          null,
          null,
          'pobox:12345',
          '45',
          '00000',
          'DF',
          '1231231231',
          '2342342344',
          '443243242',
          '111111111',
          null,
          '123123123',
          null,
          'FD',
          'NA',
          'EC');
end;
/

回答by kralco626

Aparently, you cannot have line breaks inbetween each paramter like I did... Stupid program...

显然,你不能像我一样在每个参数之间换行......愚蠢的程序......

exec user1.contractor_reg.usp_ins_contractor_all('testing12345','test','me','a','testbiz','sdfsdf','something',null,null,null,'pobox:12345','45','00000','sdfff', '1231231231', '2342342344', '443243242', '111111111', null, '123123123', null, 'sdff', 'E1','EC')

exec user1.contractor_reg.usp_ins_contractor_all('testing12345','test','me','a','testbiz','sdfsdf','something',null,null,null,'pobox:12345','45' ,'00000','sdfff', '1231231231', '2342342344', '443243242', '111111111', null, '123123123', null, 'sdff', ') E1