Reputation: 31
Trying to create a very simple authentication procedure for use in Oracle APEX. My procedure is below
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;
And I get the old PL/SQL: SQL Statement ignored thing on the select. I got the select down to the simplest thing I could think of 'select 1 from dual'. I'm scratching my head on this one I'm afraid.
Upvotes: 0
Views: 143
Reputation: 50007
The INTO clause goes before the FROM clause, so your SELECT statement should read
SELECT 1 INTO afound FROM DUAL
For reference the general structure of a SELECT
is
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...
Share and enjoy.
Upvotes: 3