I have an Oracle Forms 6i application and there is a plsql batch and both are doing updates to the same table. There are fields that are directly mapped to table columns in a form of the Forms application. Whenever the form accessing the table is open, the plsql batch is blocked. How to create the form so that it does not block any other db sessions. Is there a way to load/create instance of the Form so that it does not hold any lock on the table?
You can try one of 2 possibilities:
1) For block there is property "Locking Mode" and one of it's values is "Delayed". Text from help:
Form Builder locks the row only while it posts the transaction to the database, not while the end user is editing the record. Form Builder prevents the commit action from processing if values of the fields in the block have changed when the user causes a commit action.
So if this value is set, then DB record will be locked only on update time.
2) Create ON-LOCK trigger for this block, with "Execution Hierarchy" property - "Override" (this is default one). And in trigger put code:
NULL;
In this case form's will not lock record and it will be done by DB only when necessary (after UPDATE statement is issued and till COMMIT or ROLLBACK is processed).
Forms locks the record only when a database-bound item is changed either by the user or by a trigger.
You probably have some WHEN-NEW-RECORD-INSTANCE or POST-CHANGE triggers that changes the values of database-bound items.
Before messing with locking modes, you should take a look on what causes forms to request a row lock. I bet you will be surprised!
Try first to disable ALL WHEN & POST trigger at Block & Item level, and examine if the form still locks the batch. After that start by enabling triggers until you spot the one that causes the problem.
Related
I use
open_from('b');
in WHEN-BUTTON-PRESSED trigger for open form B from form A.
how to close form A when I open form B by using WHEN-BUTTON-PRESSED in oracle form builder?
use new_form Built-in instead of open_form.
new_form will Exits the current form and enters the indicated form.
PROCEDURE NEW_FORM (
formmodule_name VARCHAR2,
rollback_mode NUMBER,
query_mode NUMBER,
data_mode NUMBER,
paramlist_name VARCHAR2);
Where:
formmodule_name
Then name of the called form (must be enclosed in single quotes). Datatype is VARCHAR2.
rollback_mode
TO_SAVEPOINT (The default.): Oracle Forms will roll back all uncommitted changes (including posted changes) to the current form’s savepoint.
NO_ROLLBACK: Oracle Forms will exit the current form without rolling back to a savepoint.
FULL_ROLLBACK: Oracle Forms rolls back all uncommitted changes (including posted changes) that were made during the current Runform session.
query_mode
NO_QUERY_ONLY (The default.) Runs the indicated form normally, allowing the end user to perform inserts, updates, and deletes in the form.
QUERY_ONLY Runs the indicated form in query-only mode; end users can query records, but cannot perform inserts, updates or deletes.
data_mode
NO_SHARE_LIBRARY_DATA (The default.): At runtime, Oracle Forms will not share data between forms that have identical libraries attached (at design time).
SHARE_LIBRARY_DATA: At runtime, Oracle Forms will share data between forms that have identical libraries attached (at design time).
paramlist_name
The name you gave the parameter list object when you defined it. Datatype is VARCHAR2.
simple example:
NEW_FORM ('FORM_NAME', full_rollback, query_only, no_share_library_data, p_id);
try this:
close_form('a');
open_form('b');
or
call_form('b');
By using call_form it will hide the form A and then display B and when user will exit from B then A will be active.
In Oracle Forms 10g, I have the following code in WHEN-VALIDATE-RECORD trigger.
if(some_condition > 0) then
message('test');
RAISE FORM_TRIGGER_FAILURE;
end if;
Problem is message('test'); appears multiple times. How can I make sure it appears only once.
The trigger WHEN-VALIDATE-RECORD will go off for the record that needs to be validated after leaving the record or pressing commit.
In your case I assume the message appears after a commit and you changed all your rows or at least more then one in for example the post-query trigger.
Because more then one row is changed the trigger will fire for all of these rows and you will get the message multiple times.
Try just after you query your records without changing anything to commit.
It should say there is nothing changed to commit. If it just commit for example 10 rows then this is your problem.
I googled this but, unfortunately, could not find any solution.
I have a simple form (Oracle Forms Builder 10g) with a single block. The form is written in Oracle EBS style, that is, the block is based on a view that fetches the base table fields together with the rowid and DML events (on-insert, on-update etc. triggers) are handled by a table handler package.
The functionality I wanted to add was the following: when a user creates a new record, the form automatically suggests values for all fields in the form. So, I created a WHEN-CREATE-RECORD trigger that calculates the field values and assigns them. All, except the primary key wich is based on a Sequence and is handled by the package.
Everything runs OK when I create the new record but when I attempt to save it, all I get is a FRM-40401 "no changes to save" error and nothing happens.
I tried to trace the error and it seems like the form considers the record as NEW with no changes on it. This happens even if I try to explicitly alter the record status to INSERT.
I already tried to change the default behaviour to STANDARD.COMMIT (created an ON-COMMIT trigger for that) but this did not dfix anything.
For the record, I tried to make the form table-based, getting rid of table handlers and leaving all DML to Forms. I still get FRM-40401.
I can't understand what is going wrong, any ideas please?
The record status is reset to NEW after the when-create-record trigger completes. This normally makes sense, since you are effectively setting the default values for items, but the user hasn't actually entered any data yet.
You need something to mark the record for insert after the trigger has finished - normally the user would do this when they enter some data into the record. If you want the user to be able to save the record without changing anything in it, you could perhaps add something to the save button to do a no-change assignment, e.g.
:MYBLOCK.ANYITEM := :MYBLOCK.ANYITEM;
This would cause the record to be marked for insert.
OK, for the time being I used the classic TIMER workaround and everything works as it should:
PACKAGE body form_timers IS
PROCEDURE CREATE_NEW_RECORD;
procedure do_create(name varchar2) is
timer_id TIMER;
Begin
timer_id := CREATE_TIMER(name,1,NO_REPEAT);
End;
procedure expired is
expired_timer CHAR(20);
BEGIN
expired_timer:=GET_APPLICATION_PROPERTY(TIMER_NAME);
IF expired_timer='CREATE_NEW_RECORD' THEN
CREATE_NEW_RECORD;
-- ELSIF expired_timer='T2' THEN
-- /* handle timer T2 */ NULL;
ELSE
NULL;
END IF;
END;
PROCEDURE CREATE_NEW_RECORD IS
/* create record logic goes here */
END;
END;
... but still, I'd like to know why this behaviour occurs.
I have your standard Oracle apex page to create / edit / delete a record.
I now wanted to call a stored proc when a new record is created (only on INSERT, not update/delete), so I created a Process on the page and tied it to the create button.
All is well so far....it calls the stored procedure as expected as verified by the debug messages I put in there. However, I wanted to pass the new PK created as part of the new record to the stored proc. However it is receiving null.
The process I created is set to run "On Submit - after Computations and Validations" which I think is right.
Can someone suggest why I might not be getting the new key? Is it still not available yet at that point in the form processing?
Any help appreciated.
If you are using a standard Apex "form on a table", then you can set the Return Key into Item property of the Process Row of ... process to specify a page item that will get populated with the PK of the inserted row:
You can then reference the item in your procedure call.
I Have problem in update one of my datablock textitem.
the problem will raise up because I use where condition for my datablock,and after I load the data block, I try to get new value to my text item,but after I put value there is no change...
I dont know how I can change a text item database value when my block has where condition.(the problem is it replace the value with database value.
I use oracle 6i.
When you execute a query in a block, Oracle Forms first clears the block before it populates it with the data retrieved from the database.
If you want to change what is shown in the database item after the query is done, you would normally add code to the POST-QUERY trigger on the block. This trigger fires once for each record retrieved from the database.