尝试创建一个非常简单的身份验证过程,以便在Oracle APEX中使用。我的程序在下面
create or replace function pmats_authenticate(uname in varchar2, pass in varchar2)
return boolean
as
begin
declare
afound number:=0;
begin
select 1 from dual into afound;
if afound = 1 then
return true;
else
return false;
end if;
end;
end pmats_authenticate;
我得到旧的PL / SQL:SQL语句忽略了选择。我把选择归结为我能想到的最简单的事情,从双'中选择1。我很害怕这个问题。
答案 0 :(得分:3)
INTO子句在FROM子句之前,因此您的SELECT语句应该是
SELECT 1 INTO afound FROM DUAL
作为参考,SELECT
的一般结构是
WITH ...common table expressions...
SELECT ...fields...
INTO ...bind variables...
FROM ...tables...
INNER JOIN ...other tables... ON ...conditions...
LEFT|RIGHT|FULL OUTER JOIN ...other tables... ON ...conditions...
WHERE ...conditions...
GROUP BY ...fields...
HAVING ...conditions...
分享并享受。