WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-2004, 03:05 PM
WebProWorld New Member
 

Join Date: Mar 2004
Posts: 1
hariprasad RepRank 0
Default Before Insert TRigger Mutates - Help

The following Trigger Mutates.
If we add Pragma Autonomous Transaction, It will not mutate.

Question, We want the Claimnumber+Seqnumber as unique
(IN Table they are not defined as Uniq due to certail other problems)

Now when too many records are inserted , if we have
Pragma Autonomous Transaction the seq number is not updated properly .

Is there the soulution other than pragma autonomous, and having proper seqnumber( Same principle as Order#, Line number of OrderDetail table)

when a new line is added line number should increase if order is existing if not start with 1

Hope this helps




TRIGGER "ACCOUNTING".TBI$AcctRecDetail
BEFORE INSERT ON AcctRecDetail
FOR EACH ROW
DECLARE
lnSeqNumber AcctRecDetail.SeqNumber%TYPE;
lnARDetID AcctRecDetail.ARDetID%TYPE;
BEGIN
SELECT NVL(MAX(SeqNumber), 0) + 1 INTO lnSeqNumber
FROM AcctRecDetail
WHERE ClaimNumber = :NEW.ClaimNumber;
:NEW.SeqNumber := lnSeqNumber;
IF :NEW.ARDetID IS NULL THEN
SELECT Seq$AcctRecDetail.NextVal INTO lnARDetID FROM Dual;
:NEW.ARDetID := lnARDetID;
END IF;
END;
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: , , , ,



Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0