Best way to deal with Mutating table exception with Row Level Triggers

Hello,
It seems to be that the best way to deal with Mutating Table exception(s) is to have to put all the trigger code in a package & use it in conjunction with a Statement level trigger .
This sounds quite cumbersome to me . I wonder is there any alternative to dealing with Mutating table exceptions ?
With Regards

AskTom has a good article about this,
http://asktom.oracle.com/tkyte/Mutate/index.html

Similar Messages

  • Best way to deal with hard coded variables in a package

    There is a plsql package that reads a line from a file, parses the data, does a ton of sql operation with it (select update, inserts, calculations) and then writes the output to an output file.
    The file names and the firectories are retieved from a database table.
    Example:
    select location,file_name into loc_in,file_in from temp_tbl;
    p_File_handle := utl_file.fopen (loc_in, file_in, 'W');
    My co worker is suggesting that getting the variable values from the table is not a good practice. He suggests that the values should be hard-coded in the program. Now you might ask what would happen if the file name or directory changes. His suggestion is to have a build file and do a token substitution of those hard coded values in the program and then load in to the DB. In short the process will involve the following steps:
    -Get the package from the repostory.
    -Change the file name and directory in the token file.
    -Run the build process that will replace the values in the package .
    -Load the new file (with the updated values) in to the DB.
    Example:
    This way the program will be initially coded like this:
    p_File_handle := utl_file.fopen ('${loc_in}', '${file_in}', 'W');
    After the build file runs, it will replace the values as
    p_File_handle := utl_file.fopen ('C:/test', 'testfile.dat', 'W');
    Once the file has changed with the new updated values, compile that into the database.
    Ideas/comments?

    Re: Best way to deal with hard coded variables in a package: why have you reposted using a new profile?
    Neither post provides enough clear information on what the actual requirement is. We need more data in order to comment on your idea, your co-worker's, or to suggest alternatives.
    My co worker is suggesting that getting the variable
    values from the table is not a good practice.His reasons for this are...?
    "variable values": Why do they vary? How often do they change?
    The file names and the directories are retrieved from
    a database table.How do the values get into the table? What is the volume of the data?
    Oracle version? Operating system?

  • Mutating table exception on trigger with After Insert but not with before

    Hi
    I need to maintain some constraint on the table to have only one row for values of the columns but not by primary key constraint.
    Because in case of primary key the insert would fail and the rest of the operation would be discontinued, I cannot change in the somponent that inserts the row so I have to prevent that on the table I have.
    I created a before insert trigger on the table which checks if any row exists in the table with same column values as the one being inserted. if found I delete the rows and let the insert happen (w/o raising any error). if the rows do not exist then the insert shall be continued.
    I read at place that modifying the dame table in the trigger body shall raise a mutating table exception, but I donot get the exception when the trigger is fired.
    Just when I change the trigger to after insert trigger then the nutating table exception is thrown.
    Is it the right behavior i.e. the Before insert trigger does not raise the exception and only after insert does that, since I could not find the example for before insert triggers throwing such exception so I think it is better to confirm it before finalizing the implementation.
    Thanks
    Sapan

    sapan wrote:
    Hi Tubby
    I cannot user unique constraint because that would raise an exception upon violation and the third party component that is inserting in the table would fail.
    That component does some other tasks as well after this insert and if an exception is raised then those tasks would not be performed.
    Also I cannot change the component to ignore this exception.Well then, you're in a bit of a pickle.
    I'm guessing the trigger you have been working on isn't "safe". By that i mean that it doesn't account for multi-user scenarios. You'll need to serialize access to the data elements in question and implement some sort of locking mechanism to ensure that only 1 session can work with those values.
    After you work out how to do that it sounds as though you would be better served using an INSTEAD OF trigger (you'd need to implement this on a view which is made off of your base table).
    Here's one way you can work on serializing access to your table on a relatively fine grained level (as opposed to locking the entire table).
    Re: possible to lock stored procedure so only one session may run it at a time?
    Cheers,

  • "Built In " battery ... what is the best way to deal with it ?

    Hi ... I just bought this laptop envy6-1100se with a built in battery and I actually heard alot of diffrent opinions about the best way to deal with the battery and charging and I don't know what to trust to make my batterylife the longest   so hope u can help me with that .. I want to know also if there is any damage to the battery if I kept it plugged to Ac Power even after it's totally charged ... ??

    You want to minimize the number of charge/discharge cycles so yes it is actually a real good idea to have it plugged in whenever you can. Just to illustrate, Samsung makes several models with integrated batteries and they actually have a setting in the BIOS where you can choose to cut off charging at 80% battery power. If it never goes above 80%, then discharging and charging below the 80% level never registers as a cycle. The battery has a smart chip that counts cycles. After a certain number, say 500, the battery will no longer work. This is to minimize the fire hazard from older Li-ion batteries. In other words, you trade runtime on a "full" charge for longevity of the battery. You might go from 5 hours to 4 on a single charge but the battery will last 4 years instead of two and a half. The battery can actually be replaced but it is a huge pain. The "Samsung" solution is not available on HP's that I have been able to determine.
    So, as I said there is not much you can do except use AC power as much as possible and treat the battery like your life savings; use it sparingly.
    And I recognize that when it comes to batteries on laptops, it is like a discussion of religion. There is more than one respectable opinion but this is mine.

  • How is the best way to deal with duplicate photos

    I am using a new retina 27" iMac 16gb ram OS X 10.10.1
    Aperture 3.6
    What is the best way to deal with duplicates that get in Aperture Vaults
    I have used Gemini and it finds duplicates, but I have no way of telling if the original are still there.
    I don't want to go through 15000 photos to try to find the duplicate.
    Thanks Charlie

    You mean - one image in a vault, one in a library?  Or duplicates in the same library?
    Photo Sweeper can scan several libraries or folders at the same time and display the duplicates side by side to let you pick which to keep.  You can define rules to mark photos for automatic deletion as well.
    http://overmacs.com/photosweeper.html

  • What's the best way to deal with floating point errors?

    What's the best way to deal with the decimal number errors in Flex?
    Lets say I have:
    var number1:Number = 1.1;
    var number2:Number = 1;
    var result:Number = number1 - number2;
    trace(result);
    I get "0.10000000000000009".
    What's the best way to deal with this so that i get the right result?
    Using the trick: result = Math.round( result * Math.pow(10,13) ) / Math.pow(10,13); is not useful as such when using big numbers.
    For example, If number1 = 100000000001.1, and number2 = 0.2, I get "100000000000.90001" as result. The previous rounding fixes rounding errors after 13th decimal, but here the first rounding errors come after 4 digits.
    The toPrecision method in Number and NumberFormatter dont seem be of use by themselves because of the same reason.
    So I'd have to check how big the number is, and then round the number based on that.
    So far I've constructed a method that does that with logarithms like this:
    public function floatFix(number:Number):Number{
          var precision:int = 14-Math.floor(Math.log(Math.abs(number))*Math.LOG10E);
          var precisionFactor:Number = Math.pow(10, precision);
          return Math.round(Number(number*precisionFactor))/precisionFactor;
    It just seems rather odd that one would have to create and use something like that to just count 1.1-1; There's a lot of calculating in that method, and i'm guessing that having to use that in a loop could slow down a program quite a bit.
    I think there really should be a pre-built method in flex for something like this, but I can't find any.
    Anyone know any better/faster ways?

    Use the application server database pooling services to create a datasource that can be access using JNDI.
    Move the database access code to a Servlet so that a JSP submits a form to the Servlet that does the database access and packages the data into a bean which is passed to another JSP to be displayed.

  • What is the best way to deal with memory leak issue in sql server 2008 R2

    What is the best way to deal with memory leak issue in sql server 2008 R2.

    What is the best way to deal with memory leak issue in sql server 2008 R2.
    I have heard of memory leak in OS that too because of some external application or rouge drivers SQL server 2008 R2 if patched to latest SP and CU ( may be if required) does not leaks memory.
    Are you in opinion that since SQL is taking lot of memory and then not releasing it is a memory leak.If so this is not a memory leak but default behavior .You need to set proper value for max server memory in sp_configure to limit buffer pool usage.However
    sql can take more memory from outside buffer pool if linked server ,CLR,extended stored procs XML are heavily utilized
    Any specific issue you are facing
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Best way to deal with multi-track clips?

    Hi,
    I'm editing a documentary using pre edited program masters and have been supplied the audio stems. Can anyone recommend the best way to deal with them so I can access any of the tracks within the main edit.
    I've tried creating a compound clip and adding the stems but I only access to a mono track when using the clip in my main project. I've also tried creating a multicam clip but as my stems need to be split and spaced to line up with the main Pro Res file I don't seem to be able to insert slugs into multicam clip.
    Has anyone found an elegant way to do this?
    Many thanks,
    Leigh

    Hi leiski,
    Happy New Year, and Welcome to the Support Communities!
    Compound clips are still the best way to approach this, because you have access to the stems at any time with a double-click. 
    The following resources may provide additional information:
    Audio editing overview
    http://help.apple.com/finalcutpro/mac/10.1/#verdcd1cc1
    Advanced multichannel audio editing
    Final Cut Pro automatically groups channels into audio components according to how the channels are configured for the clip. You can expand the audio portion of clips to reveal and edit audio components down to the individual channel level. This allows you to apply different effects to different components and streamlines the process for making quick sound cutouts to a single microphone input or other fine adjustments. 
    Important:  Many digital audio file formats, such as AAC and MP3, use interleaved stereo files, which do not contain separate left and right channels. These files appear as a single audio component unless you change the clip’s channel configuration. 
    Keep in mind the following when editing audio components in Final Cut Pro:You view and change the audio channel configuration of your clips in the Audio inspector. You can change audio component names, add or remove audio components, and configure channels in mono, stereo, and surround formats. See Configure audio channels.
    Configure Audio Channels
    http://help.apple.com/finalcutpro/mac/10.1/#verc1fab5f6
    Using Roles to organize clips and export audio files
    http://help.apple.com/finalcutpro/mac/10.1/#verc1faa7ce
    Cheers,
    - Judy

  • Best way to deal with same members having different parents/children

    We have a situation where some nodes need to have different parents for different application but they exist in the main hierarchy. What is the best way to deal with it? The nodes used are pretty much the same.
    Is it best to create a new hierarchy within the same version and let the nodes have different parents in it?
    -- A

    Every node has a parent in the hierarchy. You said that some nodes need different parents for different applications.
    Do these 'different parents' exist further up the tree? If they do then you can create a boolean input property that flags the nodes that exist JUST for the application. Create a new property (call it NewAppParent, let's say) with a formula that recursively climbs up the tree to find its next parent for the application, and export NewAppParent as the parent value.
    If the parent does not exist in the hierarchy then you should create an alternate hierarchy.
    If the parent exists in the hierarchy and is not an ancestor of the node then you're out of luck. Unless you create an alternate hierarchy with unique parent names.
    D

  • What is the best way to deal with different audio sample rates on the same timeline ?

    what is the best way to deal with different audio sample rates on the same timeline ?

    You don't have to do anything special. If possible, start your project with a clip that has the desired target frame rate and audio sample rate, and your project parameters will be set automatically. Other sample rates will be converted under the covers.
    For example, if your video is shot at 48khz, you can add music files at 44.1khz with no problem.
    If you are recording audio that you want to synch with video (multicam), you will get best results if everything is 48khz, but you can use 44.1 if that is all you have. Once I forgot to reset my Zoom to 48,000 and it still worked.

  • Best way to deal with Storm 9530 problems?

    Hi there,
    i'm having numerous problems with my Storm from freezeups to random reboots to an inability to connect via USB (Windows reports a problem with the connection).  Before I replace the phone I thought I would restore the phone to factory defaults to see if that solves any problems.
    Is that the best way to deal with these problems?  Can someone please point out the best way to backup my data (given that I can't connect via USB anymore) and restore the phone?
    Thanks in advance.
    [L] 

    Anyone?
    [L] 

  • Mutating table exception & use of a table column in where clause

    Hello,
    I have a scenario in which I am getting a Mutating table exception in which I have a trigger using which I insert into a second table in case there is an insert in the first table or the one which is associated with the trigger .
    my trigger code has this line which is causing the Mutating table exception :
    BEGIN
    IF INSERTING THEN
    SELECT a,b INTO var_a,var_b
    FROM tableA,tableB,tableC
    WHERE tableC.c = :new:c
    The problem is the tableC reference in my where clause is causing a Mutating table exception , but I don't see any other way in which I can get rid of it cause I need to check if new:c values exists in the table or not , can anybody suggest how I can get rid of the tableC reference in my SQL statement yet be able to check for the value of :new:C in my statement ?

    Hopefully this demonstrates the problem , the bold portion or the where clause is where I am getting flummoxed , I need to be able to compare the new value to a column in table C but if I use tableC reference I get mutating table exception
    create or replace
    trigger myTrigger
    after insert or delete or update on TableC
    referencing old as old new as new
    for each row
    DECLARE val1 number; val2 CHAR(1);
    BEGIN
    IF INSERTING THEN
    SELECT tableA.val1,tableB.val2 INTO val1,val2
    FROM TableA tableA,TableB tableB
    WHERE :new.val1
    AND :new.val1 is not null
    AND tableA.val2 = :new.val2
    AND tableB.val3 = tableA.val3
    AND tableC.val4 = :new.val5
    INSERT INTO TableD (col1 ,
    col2,
    col3,
    col4,
    col5,
    col6,
    col7,
    col8,
    col9)
    VALUES(:new.val1,
    :new.val2,
    :new.val3,
    tableA.val1,
    tableB.val2,
    :new.val4,
    :new.val5,
    :new.val6,
    :new.val7);

  • Best way to outer join a table that is doing a sub query

    RDBMS : 11.1.0.7.0
    Hello,
    What is the best way to outer join a table that is doing a sub query? This is a common scenario in EBS for the date tracked tables.
    SELECT papf.full_name, fu.description
      FROM fnd_user fu
          ,per_all_people_f papf
    WHERE fu.user_id = 1772
       AND fu.employee_id = papf.person_id(+)
       AND papf.effective_start_date = (SELECT MAX( per1.effective_start_date )
                                          FROM per_all_people_f per1
                                         WHERE per1.person_id = papf.person_id)Output:
    No output produced because the outer join cannot be done on the sub queryIn this case I did a query in the FROM clause. Is this my best option?
    SELECT papf.full_name, fu.description
      FROM fnd_user fu
          ,(SELECT full_name, person_id
              FROM per_all_people_f papf
             WHERE papf.effective_start_date = (SELECT MAX( per1.effective_start_date )
                                                  FROM per_all_people_f per1
                                                 WHERE per1.person_id = papf.person_id)) papf
    WHERE fu.user_id = 1772
       AND fu.employee_id = papf.person_id(+)Output:
    FULL_NAME     DESCRIPTION
    {null}            John DoeThanks,
    --Johnnie                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    BrendanP wrote:
    ... See the adjacent thread for the other with Row_Number().Do you mean {message:id=10564772} ? Which threads are adjacent is always changing. Post a link.
    I think RANK suits the requirements better than ROW_NUMBER:
    WITH    all_matches     AS
         SELECT  papf.full_name
         ,      fu.description
         ,     RANK () OVER ( PARTITION BY  papf.person_id
                               ORDER BY          papf.effective_start_date     DESC
                        )           AS r_num
         FROM             fnd_user             fu
         LEFT OUTER JOIN      per_all_people_f  papf  ON  fu.employee_id  = papf.person_id
         WHERE   fu.user_id  = 1772
    SELECT     full_name
    ,     description
    FROM     all_matches
    WHERE     r_num     = 1
    Johnnie: I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    See the forum FAQ {message:id=9360002}

  • HT4260 I have an AirPort Extreme and a linksys router. What is the best way to get 6-8 wired connections with ac speeds?

    I have an AirPort Extreme and a linksys router. What is the best way to get 6-8 wired connections with ac speeds?
    Appreciate your assistance.

    The answer depends on whether the AirPort Extreme is your main router....or...the Linksys device is your main router.
    In either case, the two devices must connect together using a wired Ethernet connection using CAT5e or CAT6 cabling.
    Any version of the AirPort Extreme produced within the last 5 years will have Gigabit Ethernet ports. In order to get the same speeds from the Linksys router, it will also need to be Gigabit Ethernet capable.
    If you need additional Ethernet ports, you will need to add a Gigabit Ethernet switch to either the AirPort Extreme or Linksys router.
    It is assumed that your other devices connecting to the AirPort Extreme and Linksys router will also have Gigabit Ethernet capability.
    Not sure why you mention "ac" speeds in your post. This relates to wireless connections, not wired.

  • Dw, css, and a template, what is the best way to create a 20 page website with a different header in each page?

    dw, css, and a template, what is the best way to create a 20
    page website with different header content on each page? i am
    trying to insert a specific image and background color for each
    header on every page. what is the easiest or best way to do this?
    thanks, bryan

    "mediastream13" <[email protected]> wrote in
    message
    news:f47bes$9om$[email protected]..
    > ok, murray, here is the site.
    http://www.helphotline.org
    > in I.E. 6 i can't see the background color behind the
    header images,
    I'm seeing a hot pink background (which is my browser default
    - so that I do
    remember to declare a background color). You need to add:
    body { background-color: white;} to your stylesheet, or into
    the imbedded
    styles on your page.
    In Firefox, the very top black section, #headertop is hidden
    behind the
    header image.
    > background of the date/time isn't stretching the full
    length of the
    > screen, and
    > the margins aren't working in the main content area. how
    can i put a
    > background
    > color behind the header images?
    I can see the header image stretching right across the page..
    so not sure
    what color is missing there.
    > is there anyway to download i.e. six on my computer if i
    already have
    > i.e.7? i
    > just want to be able to preview the site before i upload
    the changes. it
    > seems
    > everything works in i.e. 7.
    Yes, I used this and it works really well.
    http://tredosoft.com/Multiple_IE
    Nadia
    Adobe® Community Expert : Dreamweaver
    CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    ~ Customisation Service Available ~
    http://www.csstemplates.com.au

Maybe you are looking for

  • Web cam driver not found

    i have a hp pavillion dv6700 laptop,product no is KD311PA#ACJ.ITS WEB CAM IS NOT WORKING.i tried using youcam n lenovo web cam but no help.also the driver for this computer is also not displayed on your hp site. i'm currently using windows7 as os.

  • BPM process archiving "Processing of archiving write command failed"

    Can someone help me with the following problem. After archiving a BPM proces, I get the following messages (summary): ERROR  Processing of archiving write command failed ERROR  Job "d5e2a9d9ea8111e081260000124596b3" could not be run as user"E61006".

  • Is SSO Mandatory for ESS with ECC5.0?

    Is single sign on MAndatory for implementing ESS with SP16 ECC5.0 and mysap ERP2004 package . Becuase am not finding any options to map users for systems? inputs highly appreciated.

  • Distributed Query

    Hi Can anyone let me know whether oracle supports distributed queries. I want to write a single query which fetched data from different - different data sources and give me a consolidated output. something like select m.a, i.b, d.c, o.e from mssql m,

  • I'm not able to do calls with my iphone 4 after i download the ios 5.0.1...

    I'm not able to do calls with my iphone 4 after i download the ios 5.0.1...