Reputation: 611
I'm using Oracle Forms Builder 11.
My code:
declare
type myType is varray(3000) of my_table%rowtype;
myAsset myType:=myType();
i number;
n number;
exNoInvNum exception;
begin
go_block('my_block');
first_record;
i:=1;
loop
myAsset.extend();
myAsset(i).hqId:=:my_block.hqId;
myAsset(i).deptId:=:my_block.deptId;
myAsset(i).invNum:=:my_block.invNum;
exit when :system.last_record='TRUE';
i:=i+1;
next_record;
end loop;
go_block('my_block');
first_record;
loop
if (:my_block.linkedInvNum is not null) then
n:=0;
select count(*) into n
from my_table s
where s.invNum=:my_block.linkedInvNum
and s.hqId=:my_block.hqId
and (s.deptId=:my_block.deptId
or (s.deptId is null and :my_block.deptId is null));
if (n=0) then
for i in myAsset.first .. myAsset.last loop
if (myAsset(i).invNum=:my_block.linkedInvNum
and myAsset(i).hqId=:my_block.hqId
and (myAsset(i).deptId=:my_block.deptId
or (myAsset(i).deptId is null and :my_block.deptId is null))) then
n:=1;
end if;
end loop;
end if;
if (n=0) then
raise exNoInvNum;
else
commit_form;
go_block('my_table');
clear_block(no_validate); set_item_property('my_block.generate_excel',ENABLED,property_true); set_item_property('my_block.process_data',ENABLED,property_false);
end if;
end if;
exit when :system.last_record='TRUE';
next_record;
end loop;
exception
when exNoInvNum then
message('No existing inventory number!');
when others then
null;
end;
end;
I get Error 103 ad line 2, column 1: Encountered the symbol "END"
I checked my code for typo errors, missing semicolumns and similar stuff, but it looks like everything is fine.
Any ideas?
Upvotes: 1
Views: 8523
Reputation: 49062
I get Error 103 ad line 2, column 1: Encountered the symbol "END"
Well, you do have an extra END
keyword in your PL/SQL block.
end; end;
The syntax for an anonymous PL/SQL block is:
DECLARE
...
BEGIN
...
EXCEPTION
...
END;
And, this:
when others then
null;
is itself a bug in your code.
A when others is almost always a BUG unless it is immediately followed by a RAISE. Remember, for errors, RAISE –> CATCH –> HANDLE
. why do we need an exception handler? To catch the errors, log them(optional), and finally do something about them.
Read WHEN OTHERS THEN NULL – A bug
Upvotes: 2