|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
Database trigger
Hi all, Im trying to create a database trigger in forms builder but I keep receiving the following error when I click on save.
ORA-04021 timeout occurred while waiting to lock object username.tablename So I then revertedt o trying to create it manually using PL/SQL - here is my code Code:
CREATE OR REPLACE TRIGGER TRIGGER1 AFTER INSERT OR UPDATE OR DELETE ON PURCHASES DECLARE itemquant stock_items.quantity%TYPE; stock_new_quantity NUMBER(3):='0'; BEGIN stock_new_quantity := itemquant - :purchases.purch_quant; UPDATE stock_items SET quantity = stock_new_quantity WHERE stock_items.stock_item_id = :stock_items.stock_item_id; COMMIT; END; / I was surprised that I still get the error I have tried granting execute permissions on DBMS_LOCK with no success, has anyone got any ideas? Cheers Dirk |
|
#2
|
|||
|
|||
|
you can't have a commit inside a trigger. a trigger is, by definition, a commit-level event handler.
|
|
#3
|
||||
|
||||
|
Thankyou i'll give that a try.
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Database trigger |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|