我有一个未编译的PL / SQL过程。错误是:
Error(3,7): PLS-00103: Encountered the symbol "INTO" when expecting one of the following: ( 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 "INTO" was ignored.
Error(8,1): PLS-00428: an INTO clause is expected in this SELECT statement
。
我的代码:
CREATE OR REPLACE PROCEDURE findvisitsandlaborcosts
as
begin
select * from SI.customer;
end;
/
我已经搜索了一个在线语法检查器,它在第一行说有一个错误。但是哪里?!?这似乎是正确的。我已经用谷歌搜索了声明一个过程的语法,并且我进行了多次核对。我忽略的东西一定很简单...
在PLSQL代码中,您需要一个占位符来保留SELECT查询的结果。由于PLSQL引擎期望SELECT语句中的INTO子句。
首先,您可以选择一组列并将其值分配给局部变量。
您的代码应如下所示-
CREATE OR REPLACE PROCEDURE findvisitsandlaborcosts
as
v_column1 SI.customer.column1%type;
v_column2 SI.customer.column2%type;
begin
select column1, column2 into v_column1, v_column2 from SI.customer;
end;
/
注意-您需要先使用实际的列名替换column1和column2,然后再运行此代码。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句