Oracle updating records within same cursor
This is 'my' code of when-button-pressed trigger: DECLARE number_of_records NUMBER; where_am_i NUMBER; t1_id_prod_v t1.id_prod%TYPE; BEGIN GO_BLOCK('T2'); CLEAR_BLOCK; GO_BLOCK('T1'); last_record; number_of_records := :system.cursor_record; first_record; LOOP EXIT WHEN :system.cursor_record = number_of_records 1; IF checkbox_checked('t1.cb') THEN where_am_i := :system.cursor_record; t1_id_prod_v := :t1.id_prod; GO_BLOCK('T2'); last_record; create_record; SELECT t2.id_prod, price, price2, price3 INTO :t2.id_prod, :t2.price, :t2.price2, :t2.price3 FROM t2 WHERE t2.id_prod = t1_id_prod_v; GO_BLOCK('T1'); GO_RECORD(where_am_i 1); ELSE next_record; END IF; END LOOP; previous_record; --stop the cursor in the last record --not in the new one END; I've changed the T2 property to 'From clause query' and it works, almost, fine.
The first problem is when I checked the last record and press the button my Forms 'hangs up' (dont know how to say it in english ) and behave like making the endless loop.
LAST_RECORD='TRUE'; NEXT_RECORD; END LOOP; END; This is the latest rendition although I've been messing with different variations and just can't get it working.
"Checkbox item in another block" can probably be implemented into the T2 block's DEFAULT WHERE clause.I'd say that you never check more than one record because you GO_RECORD(pos) which returns you to the first record whose checkbox is checked and repeat what you've already done.What you should do is to move to the next record (i.e. Here's how I'd do that; attached form is based on Scott's DEPT table and created with Forms Developer 10g.Regards, Wojtek The first problem: the easiest way to see what is going on is to enable debugger so that you could follow code execution. SELECT statement returned more than a single record.