Mutating tirgger issue while setting a value

I have a table and records as below:
CREATE TABLE set_time
NUM NUMBER,
ID NUMBER,
SET_VALUE CHAR(1 BYTE),
D_TIME DATE
Insert into SET_TIME (NUM, ID) Values (1, 1);
Insert into SET_TIME (NUM, ID) Values (2, 1);
Insert into SET_TIME (NUM, ID) Values (3, 1);
Insert into SET_TIME (NUM, ID) Values (4, 1);
Insert into SET_TIME (NUM, ID) Values (5, 1);
Insert into SET_TIME (NUM, ID) Values (1, 2);
Insert into SET_TIME (NUM, ID) Values (2, 2);
Insert into SET_TIME (NUM, ID) Values (3, 2);
I need a trigger,whenever all the set_values for a particular id is set to 'Y', I need to update the column d_time as sys_date.For that I wrote below trigger
CREATE OR REPLACE TRIGGER set_time_trigger
before update
ON set_time for each row
DECLARE
v_count number;
BEGIN
if :new.set_value = 'Y' then
select 1 into v_count
from dual
where exists ( select null
from set_time
where ID = :new.id
AND ( set_value != 'Y'));
if v_count is null then
update set_time
set d_time = sysdate where ID =:new.id;
end if;
end if;
end;
But while executing the below statement:
update set_time set set_value ='Y' where id = 1;
I am gettign the follwoing error:
ORA-04091: table SET_TIME is mutating, trigger/function may not see it
ORA-06512: at "SET_TIME_TRIGGER", line 13
ORA-04088: error during execution of trigger 'SET_TIME_TRIGGER'
Is there anyway that I can achieve this?. I am using Oracle 11G.
Thanks in Advance

1) If D_TIME depends on the data that is set for multiple rows in your table, you have a normalization problem. It sounds like you need to rethink your data model and break out the ID column into a separate table.
2) A row-level trigger cannot generally query the table on which it is defined. So you generally cannot code a row-level trigger that would query the data in other rows of the table. You could define a package which had a collection of ID values, create a before update statement-level trigger that initialized the collection, create a row-level trigger that inserted the :new.id into this packaged collection, and create an after update statement-level trigger that read the data from the collection, queried the table, and did the updates as appropriate. That's a lot of work to go through and a lot of complexity to introduce.
Additionally, this sort of trigger-based approach does not generally work in a multiuser environment. If Session A is inserting a new row with an ID of 1 and a SET_TIME of N at the same time that Session B is setting the SET_TIME of all the committed rows with an ID of 1 to Y, the trigger in Session B can update the D_TIME before session A commits its data leaving you with a case where D_TIME is set and not every row with an ID of 1 has a SET_TIME of Y.
Justin

Similar Messages

  • HT3743 HT4623 We're sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care.----How to fix this issue while setting up the iphone for the new ios?

    HT4623 We're sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care.----How to fix this issue while setting up the iphone for the new ios?

    If you don't have a SIM card in the phone, you must put one in. It's required for activation.
    If you do, then your phone was probably hacked to unlock it from the original carrier. Contact them and see if they will unlock it. If they will not do so, then you can't use that phone.

  • Error while setting a value into an UDF of type date

    Hello,
    i get the following error while trying to set a value to an udf with the type "date":
    Exception from Server: RPC_E_SERVERFAULT
    This code is used:
    objDate = CDate(objLineRecordSet.Fields.Item("U_TESTDATE").Value)
    objDocument.Lines.UserFields.Fields.Item("U_ACTDATE").Value = objDate '### Here comes the error
    The application is in PL 29

    Christian,
    If you search this forum on "date UDF" you will find many posts that may assist you such as this one ...
    Format of string passed to Date/Time Hour UDF
    HTH,
    Eddy

  • Issues updating/setting multi value lookup columns via powershell

    Hi All,
         I have an issue updating multi values in a lookup field via powershell
    I can update a single value  lookup field as below but can't get to update if its multi value.
    As stated below when I hardcode it. It works.
    No idea what 'm missing. Any help will be appreciated.
    #Hardcoded works below as you can see i'm setting 3 values
    $array = @($realval.Split(';'))
    for ($i = 0; $i -lt $array.Count - 1; $i += 2)
    $word = $array[$i].Trim('#')
    $number = $array[$i+1].Trim('#')
    "$number $word"
    $lookupvalue1 = GetLookUpValues -val $number
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    [Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue = New-Object Microsoft.SharePoint.SPFieldLookupValue
    [Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue2 = New-Object Microsoft.SharePoint.SPFieldLookupValue
    [Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue3 = New-Object Microsoft.SharePoint.SPFieldLookupValue
    $lookupvalue.LookupId = 1
    $lookupvalue2.LookupId = 2
    $lookupvalue3.LookupId = 6
    $itemValues.Add($lookupvalue)
    $itemValues.Add($lookupvalue2)
    $itemValues.Add($lookupvalue3)
    #$itemValues.Add($lookupvalue)
    $CMRSItems["Event Type"] = $itemValues;
    Write-Host "items:" $itemValues
    $CMRSItems.Update()
    # This works when its updating only one value but when it needs to update multivalue it only updates the last one
    #so for example with the lookupvalue above only 6 gets updated below
    $array = @($realval.Split(';'))
    for ($i = 0; $i -lt $array.Count - 1; $i += 2)
    $word = $array[$i].Trim('#')
    $number = $array[$i+1].Trim('#')
    #$number
    "$number $word"
    #send param to GetLoolValues func to return records as SPFieldLookupValue
    $lookupvalue1 = GetLookUpValues -val $number
    #I can view the lookupvalue returned successfully
    #Write-Host $lookupvalue1
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    #This LookupId returns 3 values like on the hardcoded one above like so :1,2,6
    $lookupvalue.LookupId = $number
    $itemValues.Add($lookupvalue)
    $CMRSItems["Event Type"] = $itemValues;
    #I can view the items returned successfully
    Write-Host "items:" $itemValues
    $CMRSItems.Update()

    The problem I can see with your code is that the below line of code, you are instantiating inside the for loop. This should have been outside the for loop as by keeping it inside the loop you are overriding the value.
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    Please have a look at the below solution and modify your code as per your requirement. What I am trying to achieve in the below code is that I have a listA in which one of the field is being used as a multi-lookup in my listB.
    $lookupCollection = $something.split(";")
    $LookupMasterList=$web.Lists["ListA"]
    [Microsoft.SharePoint.SPFieldLookupValueCollection] $lookupValueCollection = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
    #Get the Lookup Item from Parent List
    foreach($item in $lookupCollection){
    IF([string]::IsNullOrEmpty($item.trim())) {
    continue;
    $LookupItem = $LookupMasterList.Items | Where-Object { $_.Item("FieldInternalName") -eq $item.trim()}
    if($LookupItem -ne $null)
    $myLookup = New-Object Microsoft.Sharepoint.SPFieldLookupValue($LookupItem.ID,$item.trim())
    $lookupValueCollection.Add($myLookup);
    #Set the Lookup field value
    if([string]::IsNullOrEmpty($lookupValueCollection)){
    continue;
    else{
    $newItem["Lookupfieldinternalname"] = $lookupValueCollection
    The above logic has no hard coding and it fetches the lookup information directly from the master list and generates a collection based on that. You can modify the above code as per your requirement.
    Geetanjali Arora | My blogs |

  • Error while setting Minimum value to  Input Number Spin Box..

    Hai
    I drag and drop a VO and created a table.In that table,i convert a column which contain an InputText field to Input Number Spin Box.At the time of page load ,the table fetches the datas from the DataBase and showing Number values in the SpinBox.After that,When i scroll the table through vertical scrollBar,the table showing *"fetching data"* and Error is throwing as *"The value must be Number"* .. In the VO,this attribute is Number.
    THIS ERROR ONLY OCCURS when i set the Minimum value of spinBox ..The purpose of setting minimum value is that i only want user to select ve value only..How can i restrict the user for selecting only ve values..?(ie,*How can i set minimum value to SpinBox?)*

    Try changing the datatype of your attribute in the EO to be Double instead of Number.

  • Problem while setting new value to entity object attribute in doDML meathod

    Hi all,
    I am overriding the entity objects doDML method for generating the value of Sequence Number just before insert .
    For this puropose i am using doDML method. I am fetching the maximum value for the sequence number feild from the table by a prepared statement
    and then incrementing that value by one.
        protected void doDML(int operation, TransactionEvent e) {
            if (operation == DML_INSERT) {
                // code for getting the max+1 of sequence number before insert
                //command executes.
                try {
                    System.out.println("Inside doDML Method");
                    String sql =
                        "select nvl(max(seq_no),0)+1  from WF_LEAVE_HDR where org_unit_code = " +
                        this.getOrgUnitCode();
                    PreparedStatement pstmt =
                        getDBTransaction().createPreparedStatement(sql, 0);
                    ResultSet rs = pstmt.executeQuery();
                    rs.next();
                    Integer newSeqNo =rs.getInt(1); //(Number)rs.getString(0);
                    //this.setSeqNo(new Number(newSeqNo));
                    setAttributeInternal("SeqNo",new Number(newSeqNo));
                    System.out.println("Value of new seq no is -->>"+getSeqNo());
                } catch (Exception excpt) {
                    System.out.println("Inside catch block ");
                    excpt.printStackTrace();
            super.doDML(operation, e);
        }i am getting the value correct by using the sql statement but while i am using setAttributeInternal("SeqNo",new Number(newSeqNo));
    it is giving an error and value for new sequence no is not passed to the seq no feild of the entity object. I have tried this.setSeqNo(new Number(newSeqNo))
    but it is also not wotrking .
    Any one please help , I am using Jdeveloper 10.1.3
    Thanks all in advance.

    iloveoracle,
    Sigh... in addition to doing this in doDML (which Dimitar points out is the wrong place to do this)... you are making a huge huge mistake.
    select nvl(max(seq_no),0)+1  from WF_LEAVE_HDRWhat happens when two people do this at around the same time? You don't do any locking, so you will get two rows with the same SeqNo. This is absolutely the wrong way of doing sequence numbers. The best way of doing this would be to use real sequence numbers (an Oracle sequence) and ignore the fact that there will be gaps. If you insist on using your approach, you MUST LOCK THE ENTIRE TABLE before you try to do your little max() + 1 trick, otherwise you run the very real risk of getting duplicate SeqNos. OK, I see that you are trying to do sequences by org_unit_code, so you don't have to lock the whole table, but you do have to have some way of holding a lock. You must also write some code to be able to handle an "unable to get the lock because someone else already holds it" type of situation.
    <rant>
    I have seen so many people try to do this little max() + 1 trick. It DOES NOT, WILL NOT work until you handle locking properly. One question that I often ask when I interview database developers is about generating "gapless" sequences; unless the job is for a brand-new-with-absolutely-no-experience trainee, answering "select max() + 1" without any mention of concurrency issues would be grounds for an immediate rejection of the candidate. Seriously. Have a run over to http://asktom.oracle.com and search for "gapless" if you'd like to see a more strongly worded rant.
    </rant>
    Bottom line, just use an Oracle sequence if it's at all possible; otherwise, be prepared to write some bunches of code to deal with locking.
    John

  • BEx report issue on setting offset value

    Friends,
    I have got a Bex reporting requirement as follows.
    Given a Calendar week I have to show data for 5 Key figures for the next 3 calendar weeks.  For ex: if I enter 05/2006 I have to show data for 05/2006, 06/2006 and 07/2006. 
    I thoght of using the Off Set parameter for all the Key figures, and for testing I did for 2nd set of Key figures with off set (1)..but these key figures are not showing any data.. Is it I am missing anything here ??
    Please comment if you have any better thoght of doing this..
    Thanks
    Mavi

    Hi,
      The format of period you gave refers to month i believe. If it is right, check the offsets once again. If the user enters fiscal year period, it should be converted in to week period using an customer exit variable(if you don,t have 0CALWEEK) and set offsets.
    Check this link, you may get some idea from that.
    Re: Aging Report

  • MWA: Issue while capturing the values entered, before displaying the LOV

    I have created a LOV in Mobile Web Application using PL/SQL procedure.
    I'm not able to get the values entered by the user before displaying the List of values.
    I need the values entered to pass it to the query.
    There might be a seeded event or method to capture these values.
    Any help would be appreciated.
    Thanks,

    Before invoking Input task, I have created a transformation to initailize the payload elements, so that in the UI these field elements will be become editable.
    I have an ADF table which is used to insert account details elements which is initialized in the transformation with namespace.You can simple use a ADF form to do this. Create ADF editable input fields in a panelFormLayout and wehn user enters values and clicks ona button .. pass those values to BPM payload.
    See - http://andrejusb.blogspot.com/2010/10/initializing-oracle-bpm-11g-process.html

  • Issues while setting up custom authenticator for weblogic

    whene can I find sample source code for setting up the custom authenticator.

    send a test mail at [email protected], will send u d source code!!

  • E31 - Unable to set Bios values through WMI

    Dear All,
    I am trying to set Bios values on E31 through a VB Script using WMI in our lab. It is working on all the machines except one. It does not return an error while setting the value or saving it. But when I manually enter Setup, the values would not be set. No error is set in Event viewer.
    Manually modifying the value works.
    Machine type: E31 (2552CS4)
    Bios Version: 9SKT61AUS
    Values trying to set:
    Select Active Video=IGD
    Total Graphics Memory=128MB
    Multi-Monitor Support=Enabled
    Core Multi-Processing=Enabled
    etc.
    Command executed:
        ObjItem.SetBiosSetting Select Active Video,IGD;
        ObjItem.SetBiosSetting Multi-Monitor Support,Enabled;
        ObjItem.SetBiosSetting Core Multi-Processing,Enabled;
    Can anyone tell me what could be wrong with the machine. How it can be corrected.
    Thanks in advance.
    -Uttam

    Are those values (WMI commands) actually changing anything from what the defaults are?
    It's odd that you've seen it work correctly on other E31 systems but fail on only this one.  Is there something in the configuration that's unique to this system as compared to the other E31 systems that passed with no issue?
    In the failing scenario, which value(s) are not getting set correctly?

  • Issue in Setting up MySQL DB with ATG 10.0.3

    Hi All,
    I am facing the below issue while setting up the MySQL DB with the ATG 10.0.3 version.
    **** Error Thu Aug 30 23:45:25 CDT 2012 1346388325927 /atg/dynamo/service/jdbc/JTDataSource an exception was encountered while trying to populate the pool with the starting number of resources:
    atg.service.resourcepool.ResourcePoolException: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306
    **** Error Thu Aug 30 23:45:25 CDT 2012 1346388325968 /atg/dynamo/service/jdbc/JTDataSource The connection pool failed to initialize propertly, i.e. the starting number of connections could not be created; check your database accessibility and JDBC driver configuration
    Please help to resolve this issue.

    Weblogic comes with ojbc driver for oracle db but I've never tried it with mysql - I just looked and theres mysql-connector-java-commercial-5.1.14-bin.jar in weblogic server/lib directory. Make sure its coming up in your class path log output when you startup weblogic.
    -Kip

  • Issue with Setting Application Item

    Hi All,
    I have an issue with setting the value of application item G_USER_ID as part of the login process.
    I use customized authentication for login. I have created an application item G_USER_ID, and in my CUSTOM_AUTH procedure, I am setting its value as APEX_UTIL.SET_SESSION_STATE('G_USER_ID', l_user_id);
    For some reason, the value is not set to G_USER_ID the first time I login. When I log out and login again without closing the browser, the value is set. Note that I even tested with a static value instead of l_user_id like APEX_UTIL.SET_SESSION_STATE('G_USER_ID', '5555555'); but still fails to set during the first login.
    I hope someone can guide me as to what I am doing wrong here.
    Thanks!
    JMcG

    What does this do?
    :SVR_FLAG := NVL(l_mult_svr,'N');
    Scott

  • Issue in populating dynamic values in smartform

    Hi Experts,
    I am facing some serious alignment issue while populating dynamic values in smartform.
    Through table, I am populating  dynamic values in smart form. If my internal table contains 20 records , first 10 records are populating in first page and remaining records are populating in next page properly. But here issue is whenever that first 10 records are populated in first page system automatically leaves empty row at the end of page. Ideally it should not happen. please tell me how to solve this issue.
    thanks
    Karthik

    Hi,
    I was wondering how are the bold lines output, if you only have one line type... is the Table node executed multiple times under the loop node, where the bold text is implemented as separate text node..? It should IMO actually not affect the output of the table in any negative way if it's done so - just curious
    With the "protect" I meant this baby:
    You could also try to download and attach only the (upper) node involved in the output of table instead of whole form, if there is something in the form that should not be seen publicly...
    cheers
    Janis

  • Set init values for Edit Form

    Hi!
    I'm using JDev 10.1.3+ADF+Struts
    I have some attributes in viewObject, and have related bindings in PageDef. I whant to set init values for that attributes in 2 cases:
    1. Edit Form doesn't contain fields for entring attribute value.
    For example:
    Current_User
    Creation_Date
    etc.
    2. Edit Form contain fields for entring attribute value. And i want that input fields display my init values.
    The purpose is to perform it in onCreate event in PageController.
    But i don't know where to put my values.
    Any help will be appriciated!

    Thank you very much!
    Maybe my question is not so clear.
    I mean, when we call event=Create i need to set values, but before Submit/Commit the Row in viewObject is not exist.
    So I founded solution for this issue - to set my values in method 'create' of Entity Object.
    I have another big problem i confused with. Would you help me, please?
    Description is here:
    Database Constraint Error Handling on create/edit (Struts ADF)

  • "Message from Webpage (error) There was an error in the browser while setting properties into the page HTML, possibly due to invalid URLs or other values. Please try again or use different property values."

    I created a site column at the root of my site and I have publishing turned on.  I selected the Hyperlink with formatting and constraints for publishing.
    I went to my subsite and added the column.  The request was to have "Open in new tab" for their hyperlinks.  I was able to get the column to be added and yesterday we added items without a problem. 
    The problem arose when, today, a user told me that he could not edit the hyperlink.  He has modify / delete permissions on this list.
    He would edit the item, in a custom list, and click on the address "click to add a new hyperlink" and then he would get the error below after succesfully putting in the Selected URL (http://www.xxxxxx.com), Open
    Link in New Window checkbox, the Display Text, and Tooltip:
    "Message from Webpage  There was an error in the browser while setting properties into the page HTML, possibly due to invalid URLs or other values. Please try again or use different property values."
    We are on IE 9.0.8.1112 x86, Windows 7 SP1 Enterprise Edition x64
    The farm is running SharePoint 2010 SP2 Enterprise Edition August 2013 CU Mark 2, 14.0.7106.5002
    and I saw in another post, below with someone who had a similar problem and the IISreset fixed it, as did this problem.  I wonder if this is resolved in the latest updated CU of SharePoint, the April 2014 CU?
    Summary from this link below: Comment out, below, in AssetPickers.js
    //callbackThis.VerifyAnchorElement(HtmlElement, Config);
    perform IISReset
    This is referenced in the item below:
    http://social.technet.microsoft.com/Forums/en-US/d51a3899-e8ea-475e-89e9-770db550c06e/message-from-webpage-error-there-was-an-error-in-the-browser-while-setting?forum=sharepointgeneralprevious
    TThThis is possibly the same information that I saw, possibly from the above link as reference.
    http://seanshares.com/post/69022029652/having-problems-with-sharepoint-publishing-links-after
    Again, if I update my SharePoint 2010 farm to April 2014 CU is this going to resolve the issue I have?
    I don't mind changing the JS file, however I'd like to know / see if there is anything official regarding this instead of my having to change files.
    Thank you!
    Matt

    We had the same issue after applying the SP2 & August CU. we open the case with MSFT and get the same resolution as you mentioned.
    I blog about this issue and having the office reference.
    Later MSFT release the Hotfix for this on December 10, 2013 which i am 100% positive should be part of future CUs.
    So if you apply the April CU then you will be fine.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

Maybe you are looking for