Forms 6i, same module generates different LOCK-Statements on different
Topic : Forms 6i, same module generates different LOCK-Statements on different
instance
Error : FRM-40654 : Record has been changed" Error!
Hi, we have a real problem and do not understand it. A Forms-modul without
specified ONLOCK Section generates the LOCK Statement itself. The problem
is that dependend on the Instance ( same datamodel but different release
level ) it generates different LOCK Statements. The Lock is on a view :
Code:
INSTANCE ORCK super!:
SELECT
LAEI_LAD_GEW,LAEI_LDM_GEW,LAEI_EIG_GEW,LE_ZEICHEN,LE_NR,KZ_LAENGE,
GATTUNG,BUCH_NR,MAND_NR,AUFT_NR,LAEI_LFD_NR
FROM
v141 WHERE ROWID=:1 FOR UPDATE OF LAEI_LAD_GEW
INSTANCE OREK BAD; locks almost the complete table:
SELECT ROWID,LAEI_LAD_GEW,LAEI_LDM_GEW,LAEI_EIG_GEW,LE_ZEICHEN,LE_NR,
KZ_LAENGE,GATTUNG,BUCH_NR,MAND_NR,AUFT_NR,LAEI_LFD_NR
FROM
v141 WHERE LAEI_LFD_NR=:1 FOR UPDATE OF LAEI_LAD_GEW
We found a workaround and specified some (the tables PK ) colums as
Primary key in the data block of the view, but ... we do not understand
the behavior.
The views are the same, the prime keys if the base tables are the same.
LADEEINHEITEN, AUFTRAEGE are views on single table; GATTUNGEN is a table;
Does anybody know about the mechanism, or have do i to write an article
about 'the secret life of Forms 6i Modules'?
SELECT vw_0141_orca777.le_rowid
FROM vw_0141_orca777
WHERE vw_0141_orca777.auft_nr = 13826
The Explain-plan on Test Environment (OREK) is different from the Explain-plan (ORCK)!!!
EXPLAIN-Plan Test-DB OREK
SELECT STATEMENT, GOAL = CHOOSE 6 1 35
NESTED LOOPS 6 1 35
NESTED LOOPS 6 1 31
INDEX RANGE SCAN LPK AUFT_PK 3 1 10
TABLE ACCESS BY INDEX ROWID LPK LADEEINHEITEN 3 3 63
INDEX RANGE SCAN LPK LAEI_AUFT_FK_I 2 3
INDEX UNIQUE SCAN LPK GATT_PK 650 2600
EXPLAIN-Plan Prod-DB ORCK
SELECT STATEMENT, GOAL = CHOOSE 5 1 41
NESTED LOOPS 5 1 41
NESTED LOOPS 5 1 37
TABLE ACCESS BY INDEX ROWID LPK LADEEINHEITEN 4 1 27
INDEX RANGE SCAN LPK LAEI_AUFT_FK_I 3 1
INDEX UNIQUE SCAN LPK AUFT_PK 1 1 10
INDEX UNIQUE SCAN LPK GATT_PK 706 2824
With rule-hint the explain-plan on test-environment OREK ist the same as productional ORCK
SELECT STATEMENT, GOAL = CHOOSE 5 1 41
NESTED LOOPS 5 1 41
NESTED LOOPS 5 1 37
TABLE ACCESS BY INDEX ROWID LPK LADEEINHEITEN 4 1 27
INDEX RANGE SCAN LPK LAEI_AUFT_FK_I 3 1
INDEX UNIQUE SCAN LPK AUFT_PK 1 1 10
INDEX UNIQUE SCAN LPK GATT_PK 706 2824
And now thats very interesting : following SQL on OREK Test-DB fails with ORA-01445
ORA-01445: cannot select ROWID from a join view without a key-preserved table
Cause: A SELECT statement attempted to select ROWIDs from a view derived from a join operation.
Because the rows selected in the view do not correspond to underlying physical records, no ROWIDs can be returned.
SELECT *
FROM vw_0141_orca777
WHERE vw_0141_orca777.ROWID = (SELECT vw_0141_orca777.le_rowid
FROM vw_0141_orca777
WHERE vw_0141_orca777.auft_nr = 13826)
But with RULE-Hint (same Explan-plan as ORCK Prod-DB )
The SAME Statement on OREK Test-DB worked WITHOUT ORA-ORA-01445
SELECT /*+RULE*/ *
FROM vw_0141_orca777
WHERE vw_0141_orca777.ROWID = (SELECT vw_0141_orca777.le_rowid
FROM vw_0141_orca777
WHERE vw_0141_orca777.auft_nr = 13826)
Conclusion :
Depending on the Execution-PLAN Oracle decided if it can return a rowid or not
In production-DB (ORCK) the problem never arised due to production amount data.
So if a View is adressed in Oracle forms it is recommended for locking
to specify the right columns as prime-key columns
you should not let Forms take control.
Bookmarks