Reputation: 23
In the below procedure i did something wrong and im not getting where i went wrong getting "encountered the symbol "end" when expecting one of the following " Please help me and explain with wat is wrong in the procedure.
create or replace PROCEDURE CRangeproc(in_termid IN VARCHAR2,in_cardno IN VARCHAR2,p_ResultSet OUT SYS_REFCURSOR,outcount OUT NUMBER)
AS
BEGIN
select count(*) into outcount from cardrangetable where PAN_LOW <= in_cardno AND PAN_HIGH >= in_cardno and terminal_id = in_termid;
IF outCount = 1 then
Open p_ResultSet FOR
select ISSUERTABLEID,ACQUIRERTABLEID,PANLENGTH from cardrangetable where PAN_LOW <= in_cardno AND PAN_HIGH >= in_cardno and terminal_id = intermid;
CLOSE p_ResultSet;
else
end if;
End CRangeproc;
Thanks in advance
Upvotes: 1
Views: 7749
Reputation: 220842
PL/SQL doesn't allow empty blocks like other languages. One way to circumvent this is to put a NULL;
statement where you don't have any other statement:
IF outcount = 1 THEN
OPEN p_resultset FOR [...]
CLOSE p_resultset;
ELSE
NULL; -- The NULL statement
END IF;
Upvotes: 0
Reputation: 10541
You need some code between else and end if. Or just remove the else:
begin
select count(*)
into outcount
from cardrangetable
where pan_low <= in_cardno
and pan_high >= in_cardno
and terminal_id = intermid;
if outcount = 1
then
open p_resultset for
select issuertableid
,acquirertableid
,panlength
from cardrangetable
where pan_low <= in_cardno
and pan_high >= in_cardno
and terminal_id = intermid;
exit when p_resultset%notfound;
close p_resultset;
else
-- You need some code here or remove the else.
end if;
end crangeproc;
Upvotes: 2