Oracle updating records within same cursor


16-Mar-2017 13:50

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.



Can someone tell me why this wouldn't work?What I am trying to do is take the data from one table using a cursor and using this data to update another table with.… continue reading »


Read more

Oracle Forms Loop Not Quiet There Oracle Forms… continue reading »


Read more

This Oracle tutorial explains how to use the Oracle / PLSQL WHERE CURRENT OF statement with syntax and examples. If you plan on updating or deleting records that have.… continue reading »


Read more

ORACLE-BASE - Bulk Binds BULK COLLECT & FORALL and Record Processing in Oracle. the same DML operation for each. records we first create a test.… continue reading »


Read more

Using PL/SQL Collections and Records. Within the database. The element type -- is a record that contains the same fields as the cursor --.… continue reading »


Read more