Sql oracle11g中的编译过程

Sql oracle11g中的编译过程,sql,oracle,procedure,squirrel-sql,Sql,Oracle,Procedure,Squirrel Sql,我使用客户机squirrel在Oracle11g中创建了一个简单的过程,代码如下 create or replace procedure EXAMPLE_P is begin 1+2; end;/ 在执行死刑时,我得到了这个警告 Warning: Warning: execution completed with warning SQLState: 99999 ErrorCode: 17110 Position: 0 Query 1 of 1, Rows read: 0, El

我使用客户机squirrel在Oracle11g中创建了一个简单的过程,代码如下

create or replace procedure EXAMPLE_P is
begin
    1+2;
end;/
在执行死刑时,我得到了这个警告

Warning:   Warning: execution completed with warning
SQLState:  99999
ErrorCode: 17110
Position: 0

Query 1 of 1, Rows read: 0, Elapsed time (seconds) - Total: 0.031, SQL query: 0.031, Building output: 0
这里的问题是,我不能调用我的程序

begin
    EXAMPLE_P();
end;/
当我执行上面的块时,我得到了这个错误

Error: ORA-06550: line 2, column 9:
PLS-00302: component 'EXAMPLE_P' must be declared
ORA-06550: line 2, column 2:
PL/SQL: Statement ignored

SQLState:  65000
ErrorCode: 6550
Position: 37
表中存在状态为“无效”的所有_对象的过程。 我试图编译它(验证状态),但我不会处理下面的查询

alter procedure EXAMPLE_P COMPILE;

有人知道我可以做些什么来调用我的过程(我使用了PL/SQL developer,但从来没有遇到过这个问题)

你不能调用你的过程,因为你没有创建它。您没有创建它,因为您没有
1+2
的分配目标。您必须声明一个变量才能将其放入。您还将
/
放在了错误的位置

比较这两者之间的差异:

SQL> create or replace procedure EXAMPLE_P is
  2  begin
  3      1+2;
  4  end;/
  5  /

Warning: Procedure created with compilation errors.

SQL> create or replace procedure EXAMPLE_P is
  2    i number; -- Declare a variable
  3  begin
  4      i := 1 + 2; -- assign something to the variable.
  5  end;
  6  /

Procedure created.
然后你就错叫了。如果没有参数,则不应包含
()

我试图在PL/SQL developer中创建您的过程,但出现以下错误:;所以,我有点惊讶你从来没有遇到过问题

过程警报的编译错误。示例\u p

错误:PLS-00103:在期望一个 以下:

   ( 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 "return" was substituted for "1" to continue. Line: 3 Text: 1 + 2;
(begin case declare exit for goto if loop mod null pragma
使用时升高返回选择更新
   ( 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 "return" was substituted for "1" to continue. Line: 3 Text: 1 + 2;