Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old June 14th, 2004, 10:58 PM
DirkPitt's Avatar
DirkPitt DirkPitt is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: New Zealand
Posts: 294 DirkPitt User rank is Sergeant (500 - 2000 Reputation Level)DirkPitt User rank is Sergeant (500 - 2000 Reputation Level)DirkPitt User rank is Sergeant (500 - 2000 Reputation Level)DirkPitt User rank is Sergeant (500 - 2000 Reputation Level)DirkPitt User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 4 h 29 m 40 sec
Reputation Power: 12
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

Reply With Quote
  #2  
Old June 16th, 2004, 11:54 AM
astrocanis astrocanis is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 14 astrocanis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to astrocanis
you can't have a commit inside a trigger. a trigger is, by definition, a commit-level event handler.

Reply With Quote
  #3  
Old June 16th, 2004, 03:58 PM
DirkPitt's Avatar
DirkPitt DirkPitt is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: New Zealand
Posts: 294 DirkPitt User rank is Sergeant (500 - 2000 Reputation Level)DirkPitt User rank is Sergeant (500 - 2000 Reputation Level)DirkPitt User rank is Sergeant (500 - 2000 Reputation Level)DirkPitt User rank is Sergeant (500 - 2000 Reputation Level)DirkPitt User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 4 h 29 m 40 sec
Reputation Power: 12
Thankyou i'll give that a try.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Database trigger


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway