日期:2014-05-17  浏览次数:22433 次

新人在此 SELECT 语句中缺少 INTO 子句
CREATE OR REPLACE PROCEDURE PROADMININFO
(ADMINNAME in varchar2,ADMINPWD in varchar2)
IS
BEGIN
select * from userinfo where loginid=ADMINNAME and password=ADMINPWD;
END PROADMININFO;



PROCEDURE ZXDRB.PROADMININFO 编译错误

错误:PLS-00428: 在此 SELECT 语句中缺少 INTO 子句
行:5
文本:select * from userinfo where loginid=ADMINNAME and password=ADMINPWD;


------解决方案--------------------
要么使用游标,要么有几个字段定义几个变量如:
SQL code

CREATE OR REPLACE PROCEDURE PROADMININFO(ADMINNAME in varchar2,
                                         
                                         ADMINPWD in varchar2) IS
cur_restdata  tbl_rest_waiting_queue%rowtype;--定义游标
   begin
   select *
    into cur_restdata
  from userinfo where loginid=ADMINNAME and password=ADMINPWD;
    end;
END PROADMININFO;

------解决方案--------------------
select 后面缺少赋值into给变量
------解决方案--------------------
探讨

要么使用游标,要么有几个字段定义几个变量如:SQL code

CREATE OR REPLACE PROCEDURE PROADMININFO(ADMINNAME in varchar2,

ADMINPWD in varchar……

------解决方案--------------------
END PROADMININFO 前面来个end;
------解决方案--------------------
在pl/sql程序中不允许出现不带into子句的select语句。
参考代码如下:如果查询出来只有一条记录

SQL code

CREATE OR REPLACE PROCEDURE PROADMININFO
(adminName in varchar2, adminPWD in varchar2)
IS
    rec userinfo%ROWTYPE;
BEGIN
    SELECT * INTO rec FROM UserInfo WHERE loginid = adminName AND password = adminPWD;
END PROADMININFO;

------解决方案--------------------
procedure 不能仅仅只执行一个select语句。
------解决方案--------------------
查出来的数据应该有个容器来装它