Oracle Forms - 错误 103,遇到符号 "END"
Oracle Forms - Error 103, Encountered the symbol "END"
我正在使用 Oracle Forms Builder 11。
我的代码:
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;
我收到 错误 103 广告第 2 行第 1 列:遇到符号 "END"
我检查了我的代码是否有拼写错误、缺少分号和类似的东西,但看起来一切正常。
有什么想法吗?
I get Error 103 ad line 2, column 1: Encountered the symbol "END"
好吧,您的 PL/SQL 块中确实有一个额外的 END
关键字。
end;
end;
匿名PL/SQL块的语法是:
DECLARE
...
BEGIN
...
EXCEPTION
...
END;
还有,这个:
when others then
null;
本身就是您代码中的错误。
A when others 几乎总是 BUG 除非紧接着是 RAISE.请记住,对于错误,RAISE –> CATCH –> HANDLE
。为什么我们需要异常处理程序?要捕获错误,记录它们(可选),最后对它们采取一些措施。
我正在使用 Oracle Forms Builder 11。
我的代码:
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;
我收到 错误 103 广告第 2 行第 1 列:遇到符号 "END"
我检查了我的代码是否有拼写错误、缺少分号和类似的东西,但看起来一切正常。
有什么想法吗?
I get Error 103 ad line 2, column 1: Encountered the symbol "END"
好吧,您的 PL/SQL 块中确实有一个额外的 END
关键字。
end; end;
匿名PL/SQL块的语法是:
DECLARE
...
BEGIN
...
EXCEPTION
...
END;
还有,这个:
when others then
null;
本身就是您代码中的错误。
A when others 几乎总是 BUG 除非紧接着是 RAISE.请记住,对于错误,RAISE –> CATCH –> HANDLE
。为什么我们需要异常处理程序?要捕获错误,记录它们(可选),最后对它们采取一些措施。