How can I save the first dept. for an employee in a transport table?

Hi All,
I have created a table to store the transports to an employee from department to another department.
the first department number to every employee is stored at the parent table called employees.
when I insert a new record to the transports table (which is the child for the parent employees) for an employee and the manager agrees for this transport the original value of department number in employees table will be changed to the new one. I done this process through a db trigger on the transport table.
Now the problem is that the original value of the first department number will be lost cause of the db trigger that changes this value after manager agreement!
I looked to solve the problem by adding a new column in employees table to save the first dept. no. for each employee only if Count of records = 1 for that employee like this:
-- Before Update DB Trigger on Transports Table:
DECLARE
pragma autonomous_transaction;
N NUMBER;
BEGIN
SELECT count(EMP_SID) -- emp-sid is the FK referenced from employeess.emp_sid
INTO N
FROM TRANSPORT_TRANS
where emp_sid=:NEW.EMP_SID
GROUP BY EMP_SID;
     IF :NEW.AGREE_FLG = 1 AND N = 1 THEN -- If the manager agrees and this record is the first one for that employee
     UPDATE EMPLOYEESS E
     SET E.FST_AD=E.ADMINISTRATION_SID, -- E.ADMINISTRATION_SID has the oroginal value for admin no. and FST_AD is the new column to save the first value
            E.FST_HE=E.HEADQUARTERS_SID,
            E.ADMINISTRATION_SID = :OLD.ADMIN_SID, -- changing the value with then new one added on the table
            E.HEADQUARTERS_SID = :OLD.HEAD_SID
           WHERE E.EMP_SID = :OLD.EMP_SID;
     ELSIF :NEW.AGREE_FLG = 1 AND N != 1 THEN -- if the manager agrees but the record is not the first record for that employee
     UPDATE EMPLOYEESS E
        SET   E.ADMINISTRATION_SID = :OLD.ADMIN_SID, -- only change the original  values
                 E.HEADQUARTERS_SID = :OLD.HEAD_SID
                 WHERE E.EMP_SID = :OLD.EMP_SID;
     END IF;
END;But the form gives me this error if I deleted (pragma autonomous_transaction;) st. :
ORA-04091: table transports is mutating, trigger/function may not see it
But when I keep it, the form gives me this error:
ORA-06519: active autonomous transaction detected and rolled back
Edited by: Dev. Musbah on Aug 18, 2009 2:09 AM

Dev. Musbah,
First make sure that the insert statement executes. And check whether other error messages are getting. Currently you are checking only NO_DATA_FOUND. so change the exception part with
EXCEPTION
     WHEN NO_DATA_FOUND THEN NULL;
     WHEN OTHERS THEN MESSAGE('Some Error Occured');Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks.

Similar Messages

  • How can I save the cache/cookies for specific websites but delete all other cache/cookies upon exiting Firefox?

    I am using Firefox 14.0.1. I have it set to delete cache/cookies on exit, keeping my "foxden" clean. However, if I want to save the cache and cookies for a particular website, i.e a flash game that will save my current level, I cannot unless i disable the cache -clearing feature.
    I would like to be able to "add an exception" to the cache-clearing or at the very least, be able to copy the relevant files for that page and paste them back before opening Firefox again.
    Any ideas?

    That is not possible.<br />
    You can only clear the entire cache.
    If you do not want specific content to get cached or written to disk then you need to switch on Private Browsing.
    *https://support.mozilla.org/kb/Private+Browsing
    * https://wiki.mozilla.org/Firefox3.1/PrivateBrowsing/SecurityReview#Configuration
    For cookies you must not use clear history, but let all cookies expire when you close Firefox and make an allow exception for cookies from domains that you want to keep.

  • I have updated my ipod touch but i have to update iphone and ipad 1 and ipad2 . How can I save the udated software in order to avoid teh time for downloading it again each time

    I have updated my ipod touch but i have to update iphone and ipad 1 and ipad2 . How can I save the udated software in order to avoid teh time for downloading it again each time

    Even though the downloads are for the same iOS version number, they are different downloads and you can't use an iPod iOS update to update an iPhone or iPad etc. The iPad 1 and iPad 2 are also different downloads. So you will need to download different updates for your iPod Touch, iPhone, iPad 1 and the iPad 2.

  • Whenever I update my iPhone software, it asks me to sign in to iCloud with an old email address.  My other devices all have the correct address.  How can I get the correct address for my iPhone?  The only Apple ID that works for logging in is my new one.

    Whenever I update my iPhone software, it asks me to sign in to iCloud with an old email address.  My other devices all have the correct address.  How can I get the correct address for my iPhone?  The only Apple ID that works for logging in is my new one.

    To change the iCloud ID you have to go to Settings>iCloud, tap Delete Account, provide the password for the old ID when prompted to turn off Find My iPhone (if you're using iOS 7), then sign back in with the ID you wish to use.  If you don't know the password for your old ID, or if it isn't accepted, go to https//appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Tap edit next to the primary email account, tap Edit, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iPhone on your device, even though it prompts you for the password for your old account ID. Then go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https//appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

  • How can I save the images to the iPhone anywhere

    Hello  I own Time capsule 3 tb. How can I save the images to the iPhone anywhere in Time capsule
    note i used fileexplorer when Outside the home isee Outside Message " error connection failed with the error operation time out "
    Thanks

    Most Simple Back Up:
    Drag the iPhoto Library from your Pictures Folder to another Disk. This will make a copy on that disk.
    Slightly more complex: Use an app that will do incremental back ups. This is a very good way to work. The first time you run the back up the app will make a complete copy of the Library. Thereafter it will update the back up with the changes you have made. That makes subsequent back ups much faster. Many of these apps also have scheduling capabilities: So set it up and it will do the back up automatically.
    Example of such apps: Chronosync - but there are many others. Search on MacUpdate or the App Store
    If you want to back up the Photos only:
    Export them using the File -> Export command.
    This User Tip
    https://discussions.apple.com/docs/DOC-4921
    has details of the options in the Export dialogue.

  • How can i save the data in a jpanel form to a .txt document

    how can i save the data in a jpanel form to a text file using parse function,this should happen when i click a save button .
    please help me..

    each time when i fill the form and click save button ,all the data in the form should be written to a text file and each time when i repeat it should append to the old data in the text file.the elements in the form should be seperated by pipe delimeter.
    thanks for your patience..

  • How can I save the settings of my iPhone 4 before resetting the phone in addition to saving the apps etc. by synchronisation with i-tunes

    How can I save the settings of my iPhone 4 before resetting the phone in addition to saving the apps etc. by synchronisation with i-tunes

    All the phone settings are save in the backup which is automatically created when you sync the phone.
    http://support.apple.com/kb/HT1766
    Please clarify what you mean by "resetting" the phone. When you reset the phone, no data is deleted.  Do you actually mean Restore the phone?  See the User Guide, Appendix B for the correct terminology,
    http://manuals.info.apple.com/en_US/iPhone_iOS4_User_Guide.pdf

  • My computer broke and i lost all files including ITunes. what happens to all the stuff purchased already. will this appear in itues when i download it agian? how can i save the music on my ipod and transfere it over to the new itunes?

    my computer broke and i lost all files including ITunes. what happens to all the stuff purchased already. will this appear in itues when i download it agian? how can i save the music on my ipod and transfere it over to the new itunes?

    Unfortunely, all movies and songs purchased in iTunes will be lost...you'll have to purchase them again! Any applications you've purchased, you can download again for free.
    Music Rescue is a program you can use to transfer any and all data (music, movies, pictures..) from your iPod to your computer, and iTunes.
    http://www.kennettnet.co.uk/products/musicrescue/

  • How can I save the order of photos in albums? Even though I have set as album order they revert back

    How can I save the order of photos in albums in Elements 11? Even though I have set as album order they revert back to original order.

    Could you confirm that when you re-open the sorted album, the display order on the top bar just over the browsing space is still in 'album' order ? That order may have been changed to a date order. For me, I get the order of the last album I opened, not necessarily the 'album' order of the present album.

  • When I zoom in on photo using iPhoto, how can I save the zoomed in photo please?  This always looks better than cropping., When I zoom in on photo using iPhoto, how can I save the zoomed in photo please?  This always looks better than cropping.

    When I zoom in on photo using iPhoto, how can I save the zoomed in photo please?  I would like a screen shot of my zoomed in photo - is this possible?.  Cropping doesn't give the same effect as zooming in and magnifying the photo.  Any help would be appreciated thank you.  I have an iMac

    To take a screenshot of the zoomed photo, press either the key combination
         ⇧⌘3   for a screenshot of the full screen, or
         ⇧⌘4   to bring up a selection rectangle: select the section of the screen, that you want to save.
    The screenshots will be sent to your desktop; drag them from there to the iPhoto icon in the Dock to import them.

  • How can I define the possible entries for "invoicing process" at fkkinv_ma?

    At the transaction code fkkinv_ma, I fill in the fields "Date ID" and "Identification" but I have a problem with the field of "Invoicing Process". When I psh theF4 button, there comes no search help. What should I do? Should I define the possible entries first? If I should, how can I define the possible entries for "invoicing process"? How is the customization done?
    Thanks in advance for the answers.

    You have to define them in the IMG 
    Financial Accounting (new)
    Contract Account Recievable and Payable
    Business Transactions
    Invoicing
    Invoice Types
    You have to set up a number range, decide what type of Financial transactions should not be invoiced -- like  Dunning Charges
    then you have to have a developer create the form and form class of invoice.

  • I need to reinstall my Linux Mint, therfore also Thunderbird. How can I save the adresses and all my messages (copy and past in new Thunderbird after install)

    I need to reinstall my Linux Mint 17 mate, therfore also Thunderbird. How can I save the adresses and all my messages (copy and past in new Thunderbird after install)?

    Thank you for your suggestion. I have installed Linux Mint 17.1 with the Thunderbird and everything I had installed was still there. So, I didn´t need these mesures.
    Thanks anyway.

  • How can I save the modulation I apply to an instrument during recording such that it remains during playback?

    How can I save the modulation I apply to an instrument during recording such that it remains during playback? For example, I apply modulation #8 during recording, but when I play the track back the modulation is not incorporated.

    Hi Vlad,
    Unfortunately, I don't think there is a way to programmatically read the voltage output to the drive, as the voltage is all determined internally by the controller circuitry on the board. Depending on the controller though, you may be able to physically route the output terminal to a spare analog input channel and read in the voltage that way. This example Analog Input with 73xx Motion Card shows you how to program LabVIEW to do this. 

  • I canno't connect my iphone with a wire to my pc. How can I save the backup on my pc?

    Hello.
    I can't connect my iphone with a wire to my pc as the connection slot is damaged. How can I save the backup of my iphone on my pc? I already installed icloud; but it doesn't work.
    Thank you for your help and support.     

    Your only option is iCloud, to back up to the PC using WiFi, your device has to be connected to the PC at least once using the USB cable, to set this up.
    iOS: Back up and restore your iOS device with iCloud or iTunes

  • How can I make a waveform graph store the entire wave, not just the current time period and how can I save the actual graph?

    I am taking temp readings with a 4 channel DAQ, sending them to a waveform graph and exporting the data to excel, how do I manipulate the graph to take a continuous reading as opposed to losing the previous GUI and how can I save the entire graph?
    Using LabVIEW 2011 operating on Windows 7 professional. 

    That is the nature of the chart -- everything not in the history is lost (it is a FIFO buffer of length=1024 samples by default).
    The scroll bar is probably grayed out because you're show all of the data.
    Attached is a program that will add 5 random points to a graph and prompt you for a file location where to save a JPG snapshot of the graph.  It's not particularly good programming style, but it has all of the elements/concepts you're after. 
    Attachments:
    graph.vi ‏14 KB

Maybe you are looking for

  • In-App Mail (and SMS)-iPhone OS 3.1.3

    I originally had the following code: NSURL *emailURL = [[NSURL alloc] initWithString:emailAddress]; if ([[UIApplication sharedApplication] openURL:emailURL]) with the NSString emailAddress set up properly. What would happen then? I discovered the Mes

  • How to count with two char and calculate KF as per the count

    Hello All,        I have a requirement where I need to display the data as per mentioned below chart. Region is on the row side, Vendor, Material and Value on column side. I need to show Number of Vendor belongs to Global,Regional and local, Similarl

  • What do you a function?

    In JPanel have a function is valiate in order to update pictures. When I use JFrame , I must use what a function to update pictures.

  • Can't print pics in iphoto 08

    This might have something to do with recent Mac software updates but I can no longer print pics in '08. I get the message "No available themes" "until at least one theme has been installed this feature (printing) is not available" How did this happen

  • Materialized View and Refresh Fast

    Hi, Below is a sample query for generating a MV. Since I am new to Oracle, Experts please help me. create materialized view user1.mv_empdept refresh fast as select * from user1.employee e where exists(select * from user2.department d where d.deptId=e