NiceMan331
asked on
oracle forms . clear block if not empty
hi
i have one form , master/details
one filed 's_item' , when user fill item code in that field , it will call timer
to go one non_database_block 'item_summary' in same form to fill item history in that filed like this code
trigger s_item when validate item
then , when timer expire
up to here it is ok
but the problem i insert this code to clear block if it has records ,
after go_block
but it send me trigger error
i have one form , master/details
one filed 's_item' , when user fill item code in that field , it will call timer
to go one non_database_block 'item_summary' in same form to fill item history in that filed like this code
trigger s_item when validate item
timer_id :=create_timer('MY_TIMER_1',5,NO_REPEAT);
then , when timer expire
declare
j number;
Cursor c_ent IS
select * From ITEM_SUMMARY where ITEM = :GENRAL.S_ITEM order by nyear,nmon ;
vk c_ent%rowtype;
BEGIN
IF GET_APPLICATION_PROPERTY(TIMER_NAME) = 'MY_TIMER_1' THEN
begin
Go_Block('ITEM_SUMMARY');
first_record;
OPEN c_ent;
loop
fetch c_ent into vk;
exit when c_ent%notfound;
j := j + 1;
:ITEM_SUMMARY.year:= vk.nYEAR;
--- etc
up to here it is ok
but the problem i insert this code to clear block if it has records ,
after go_block
if :system.block_status = 'QUERY' Then
clear_block('no_validate');
end if;
but it send me trigger error
ASKER
frm-40735 . when timer expired trigger raised unhandeled exception
Is there any ORA error that comes with the FRM error?!
Btw: did you try to skip the code beginning with "first_record"?!
Btw: did you try to skip the code beginning with "first_record"?!
Are you sure that you want the item_summary block to be a non-base-table block? Wouldn't this form be simpler if this block just queried a table (or a view) directly?
If you have trouble figuring out which line in the trigger causes the exception, you can always re-write the trigger (temporarily) to something like this to identify the parts that work fine:
declare
... (leave this section as it is)
BEGIN
message('Step 1');
IF GET_APPLICATION_PROPERTY(T IMER_NAME) = 'MY_TIMER_1' THEN
message('Step 2');
begin
Go_Block('ITEM_SUMMARY');
message('Step 3');
first_record;
message('Step 4');
OPEN c_ent;
message('Step 4');
loop
fetch c_ent into vk;
exit when c_ent%notfound;
j := j + 1;
message('Loops: '||to_char(j));
:ITEM_SUMMARY.year:= vk.nYEAR
For example, if you see the messages: "Step 1", "Step 2" and "Step 3" but not "Step 4", you know the problem is between those two comments.
If you have trouble figuring out which line in the trigger causes the exception, you can always re-write the trigger (temporarily) to something like this to identify the parts that work fine:
declare
... (leave this section as it is)
BEGIN
message('Step 1');
IF GET_APPLICATION_PROPERTY(T
message('Step 2');
begin
Go_Block('ITEM_SUMMARY');
message('Step 3');
first_record;
message('Step 4');
OPEN c_ent;
message('Step 4');
loop
fetch c_ent into vk;
exit when c_ent%notfound;
j := j + 1;
message('Loops: '||to_char(j));
:ITEM_SUMMARY.year:= vk.nYEAR
For example, if you see the messages: "Step 1", "Step 2" and "Step 3" but not "Step 4", you know the problem is between those two comments.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
flow01 , thanx for the advice
it works ok for the 1st timer , but it fail for another one i have it in same trigger
it works ok for the 1st timer , but it fail for another one i have it in same trigger
ASKER
sorry , it is correct
the second code was wrong
the second code was wrong