Help with Mutating Error / Trigger / APEX_MAIL.SEND

Hello:
I am trying to get the apex_mail.send function working when a user submits a new record. I've taken the code from the canned Issue Tracker application code and tried to retrofit it to my tables. However I keep receiving a mutating error on line 11 (line 11 bolded below):
-- Create a trigger that will send notification after
-- the submission of each new idea on the IDEAS table.
create or replace trigger IDEAS_EMAIL
AFTER
insert or update on IDEAS
for each row
begin
IF (INSERTING AND :new.manager_name IS NOT NULL)
OR
(UPDATING AND (:old.manager_name IS NULL OR :new.manager_name != :old.manager_name) AND :new.manager_name IS NOT NULL) THEN
FOR c1 IN
(SELECT fname, lname, email
FROM ideas_users
WHERE fname||' '||lname = :new.manager_name)
LOOP
IF c1.email IS NOT NULL THEN
FOR c2 IN
(SELECT MANAGER_NAME, FULL_TEXT, SUMMARY, ID, SUBMITTED_BY, SUB_DATE
FROM IDEAS
WHERE ID = :new.ID)
LOOP
APEX_MAIL.SEND(
p_to => c1.email,
p_from => c1.email,
p_body =>
'This is a test message. ' ||chr(10)||
p_subj => 'test email subject');
END LOOP;
END IF;
END LOOP;
END IF;
end;
I've also tried setting the following line to the primary key field in the user table and inserting that value into the main table but I still get the same error message.
WHERE fname||' '||lname = :new.manager_name)
Thanks in advance for any help.

Let me get this straight..
You are inserting a row into a table, and when you insert the row, you are going to send an e-mail t o the manager who owns this row. In the data you are inserting, is the e-mail address of the manager, right?
David has provided the answer for you.. Use the :NEW.Email value instead of creating a cursor and all that.. Unless you have a need to e-mail multiple people of the record insert..
Thank you,
Tony Miller
Webster, TX
On the road of life...There are 'windshields', and there are 'bugs'
(splat!)
"Squeegees Wanted"

Similar Messages

  • Installing Elements 11 on Mac. Need help with install error "Setup wants to make changes."

    Installing Elements 11 on Mac 10.8.2. Need help with install error:  Setup wants to make changes. Type your password to allow this."  After entering Adobe password, nothing happens.  Locked from further installation.  Any ideas?  Adobe phone support could not help.

    Just before letting changes (installation in this case) be made on the system, Mac OS prompts for password & this has to be the Mac system password. This password prompt is the system's own native prompt & would accept the system password only. Please make sure it is the right system password (all/admin rights) and the installaion should run.

  • Can anyone help with this error? ;At line 102 of file"C:/Program files (x86)/Macromedia/Dreamweaver

    Can anyone help with this error please?;At line 102 of file"C:/Program files (x86)/Macromedia/Dreamweaver 8/Configuration/Objects/Common/Images.js"; TypeError: cmdDOM.parentWindow.setFormItem is not a function

    If Dreamweaver shows a message saying "the following JavaScript error(s) occurred",  it's usually a sign of a corrupt cache file. The first thing you should always be to delete the file cache. If that doesn't work, delete your personal Configuration folder. Please go through the steps mentioned in thread Deleting a corrupted cache file.

  • Please help with compiling error

    Hello, I am currently taking a class in Java Programming and need help with an error. I am working on a Mortgage Calculator and when I compile the code I get this error. I have no idea how to fix this. Can anyone help? Thank you.
    '{' expected public class MortgageCalculator
    1 error
    Tool completed with exit code 1
    Here is my code
    import java.io.*;//*java input output
    import java.util.Date;//Date Utility
    import java.util.Formatter;//format Utility
    import java.text.NumberFormat;//*format numbers
    //class MortgageCalculator
    public class MortgageCalculator
    public static void main(String[]args);{
    Date currentDate=newDate();
    DecimalFormat decimalPlaces=newDecimalFormat("0.00");
    //declare Variables
    final double principalBalance=200000;//*$200,000 Loan
    final double monthlyInterest=.06;//*6% interest rate
    final double Term=12*30;//*monthly interest rate
    final double monthlyInterest=((principalBalance*(monthlyInterest/12))/(1-Math.pow(1+(monthlyInterest/12))-(Term)));
    //Display Output
    System.out.println("\t\t" + currentDate);
    System.out.println("\t\tLoan Amount" + principalBalance);
    System.out.println("\t\tInterest Rate" + monthlyInterest);
    System.out.println("\t\tTerm of Loan" + Term);
    System.out.println("\t\tThe Payment will be:" + monthlyInterest);
    System.out.println(decimalPlaces.format(mothlyInterest));
    }

    You need to enclose your class body in { }. You're missing at least one of them

  • Help with CreateDefaultDomain error

    hello guy,
    Please i need help with this errors
    "*ERROR: An error occurred while building the default domain.*
    *Please see this log file for more details:*
    *C:\oracle\Middleware\jdeveloper\system\system11.1.1.0.31.52.05\o.j2ee.adrs\CreateDefaultDomain.log*"
    This is the content of the log.
    *"Default domain will be created:*
    *C:\oracle\Middleware\jdeveloper\system\system11.1.1.0.31.52.05\DefaultDomain*
    *C:\oracle\Middleware\wlserver_10.3\common\bin\wlst.cmd "C:\oracle\Middleware\jdeveloper\system\system11.1.1.0.31.52.05\o.j2ee.adrs\CreateDefaultDomain.py"*
    *Process started*
    *wlst > 'C:\WINDOWS\system32\QTJava.zip' is not recognized as an internal or external command,*
    *wlst > operable program or batch file.*
    *Elapsed time: 609 ms".*
    this error is effecting the applications i built.
    thank
    kolly

    just check your parameter... it means that the parameter on showInputDialog on the API dont match with the parameter with your showInputDialog code

  • Help with code errors

    Can somebody help me get rid of the following compile errors:
    coreservlets/OrderPage.java:61: setNumOrdereed(int, int) in coreservlets.ShoppingCart
    cannont be applied to (java.lang.String,int)
    cart.setNumOrdered(recordingid, numItems);
    .\coreservlets\shoppingCart.java:44 cannot resolve symbol
    symbol : variable recordingid
    location: class coreservlets.ShoppingCart
    if (order.getrecordingid() == (recordingid)) {
    .\coreservlets\ShoppingCart.java:49: cannot resolve symbol
    symbol : variable recordingid
    location: class coreservlets.ShoppingCart
    itemOrder new order = new ItemOrder(Catalog.getItem(recordingid));I know that not very helpful with out the code but the code is very big so if anyone wants me to post extracts from the code please tell me.

    Thank you i put that code in but now get the following:
    coreservlets/OrderPage.java:40:  incompatible types
    found : java.lang.strgin
    required: int int recordingid = request.getParameter("recordingid")!=null?request.getParameter("recordingid"):1;
    ^/code]
    coreservlets/OrderPage.java:48: addItem(java.lang.String) in coreservlets.ShoppingCart cannot be applied to (int)
    cart.additem(recordingid);
    .\coreservlets\AhoppingCart.java:44: cannot resolve symbol
    symbol: variable recordingid
    location: class coreservlets.ShoppingCart
    if (order.getrecordingid() == (recordingid)) {
    .\coreservlets\AhoppingCart.java:49: cannot resolve symbol
    symbol: variable recordingid
    location: class coreservlets.ShoppingCart
    ItemOrder newOrder = new ItemOrder(Catalog.getItem(recordingid));
    4 errors.
    Also could you explain what the line you added to the code means:
    !=null?request.getParameter("recordingid"):1;
    !=null?request.getParameter("numItems"):"1";and how come you got rid of if (recordingid != null) {Thanks for any help with these errors
    OK I HAVE GOT RID OF ALL THE ERRORS APART FROM THE TOP ONE:
    code]coreservlets/OrderPage.java:40: incompatible types
    found : java.lang.strgin
    required: int
    int recordingid = request.getParameter("recordingid")!=null?request.getParameter("recordingid"):1;
                                            /code]
    Message was edited by:
            ajrobson                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help with the error message that ADE is not allowed to copy a book onto my Nook. I have tried authorizing and unauthorizing many times--at wits end with this issue.

    Help with the error message that ADE is not allowed to copy a book onto my Nook. I have tried authorizing and unauthorizing many times--at wits end with this issue.

    I too am having the same problem. I have a new hard drive that was imaged from the old one and I'm trying to side load a book to my Nook Simple Touch.. I first installed ADE 4 then borrowed and downloaded a book from Overdrive. I tried a few times to delete and reauthorize both the computer and the Nook and each time I get an authorization error when I try to side load the book. I then found on the Nook forum that the Simple Touch and ADE 4 don't get along. So I uninstalled ADE 4 and installed ADE 3.
    I then followed this recommended procedure found on the forum: I deleted the Digital Editions folder from my Nook, launched ADE 3 and authorized the computer, then connected the Nook. For a few seconds, hovering the mouse over the setting icon for the Nook displayed everything on the context menu grayed out. But then it showed the context menu and I was able to display the Nook's authorization, which was the same as the computer's. Still get the same error side loading the book. Deleting and reauthorizing doesn't help.  And the Digital Editions folder is still missing from the Nook.

  • Need a little help with some errors.

    Receiving some errors..
    btn2.addActionListener(new ActionListener() {
    and also
    frame.setLocation(400,400);
    frame.setVisible(true);
    }<<~~has 2 errors here...
    Both above have class or interface expected errors..clueless on what i'm missing at the moment.
    Anyone mind pointing out what {'s and }'s i'm missing?
         btn1.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  btn1actions();
              private void btn1actions() {
                   if (radio1.isSelected()) System.out.println("Radio Button 1 is selected.");
                   if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.");
         btn2.addActionListener(new ActionListener() {
                                       public void actionPerformed(ActionEvent evt) {
                                            btn2actions();
                        private void btn2actions() {
                             if (radio1.isSelected()) System.out.println("Radio Button 1 is selected.");
                             if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.");
                   btn3.addActionListener(new ActionListener() {
                                       public void actionPerformed(ActionEvent evt) {
                                            btn1actions();
                        private void btn3actions() {
                             txt1.setText("");
                             txt1.requestFocus();
    public static void main(String[] args) {
        Test2 frame = new Test2();
        frame.setTitle("Test Frame");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 300);
        frame.setLocation(400,400);
        frame.setVisible(true);
    }

    All my code..finally posted...just need help with more errors.
    F:\DocumentsTest2.java:169: ';' expected
              btn1.addActionListener(new ActionListener()) {
    ^
    F:\Documents\Test2.java:176: illegal start of expression
              private void btn1actions() {
    ^
    F:\Documents\Test2.java:191: illegal start of expression
              private void btn2actions() {
    ^
    F:\Documents\.java:202: illegal start of expression
              private void btn3actions() {
    ^
    4 errors
    Tool completed with exit code 1
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test2 extends JFrame{
         static JButton btn1,btn2,btn3;
         static JTextField txt1;
         static JRadioButton radio1,radio2;
           public Test2() {
             Container container = getContentPane();
             container.setLayout(new BorderLayout());
              //Create Panels
                JPanel Panel1 = new JPanel();
                JPanel Panel2 = new JPanel();
                JPanel Panel3 = new JPanel();
                JPanel Panel4 = new JPanel();
                JPanel Panel5 = new JPanel();
                JPanel Panel6 = new JPanel();
                JPanel Panel7 = new JPanel();
                JPanel Panel8 = new JPanel();
                JPanel Panel9 = new JPanel();
                JPanel Panel10 = new JPanel();
              //Set Layout for Panels
              Panel3.setLayout(new BorderLayout());
              Panel4.setLayout(new BorderLayout());
              Panel5.setLayout(new BorderLayout());
              Panel6.setLayout(new BorderLayout());
              Panel10.setLayout(new BorderLayout());
              //Create the Various Fonts and Colors for this GUI
              Font font1 = new Font("SansSerif", Font.BOLD, 20);
              Font font2 = new Font("Serif", Font.PLAIN, 15);
              Color color1 = new Color(3,15,125);//A Dark Blue Color
              Color color2 = new Color(201,29,10);//A Red Color
              Color color3 = new Color(127,127,127);//A Grey Color
              //Create Buttons and Labels
             btn1 = new JButton("Submit");
             btn2 = new JButton("Display Schedule");
             btn3 = new JButton("Enter New Name");
             JLabel label1 = new JLabel("Student Name");
             JLabel label2 = new JLabel("Course Number");
              JLabel label3 = new JLabel("Welcome to the Java Community College");
              JLabel label4 = new JLabel("Registration System!");
              //Declare Text Field For Entering Student Names
              txt1 = new JTextField(15);
              //"Put Course Number from another Method Here"
              String[] courseStrings = { "CISM2230 A", "CISM2230 B", "CISM1110 A", "CISM1110 B", "CISM1120 A", "CISM1120 B" };
              JComboBox Combo1 = new JComboBox(courseStrings);
              //Declare Radio Buttons for Add and Drop Course
              radio1 = new JRadioButton("Add a Course", false);
              radio2 = new JRadioButton("Drop a Course", false);
              ButtonGroup radioButtons = new ButtonGroup();
              radioButtons.add(radio1);
              radioButtons.add(radio2);
              //Panel 10 is the Main Displaying Panel
              Panel10.add(Panel3, BorderLayout.NORTH);
              Panel10.add(Panel4, BorderLayout.CENTER);
              Panel10.add(Panel8, BorderLayout.SOUTH);
              //Panel 3 Used to Display Label 3 and 4 using Panels 1 and 2
              Panel3.add(Panel1, BorderLayout.NORTH);
              Panel3.add(Panel2, BorderLayout.CENTER);
              Panel1.add(label3);
             Panel2.add(label4);
              //Panel 4 Used to Display Student Name, Txt1, Course Number, Combo Box and Radio Buttons
             Panel5.add(label1, BorderLayout.NORTH);
             Panel5.add(txt1, BorderLayout.CENTER);
             Panel6.add(label2, BorderLayout.NORTH);
              Panel6.add(Combo1, BorderLayout.CENTER);
              Panel7.add(radio1, BorderLayout.NORTH);
              Panel7.add(radio2, BorderLayout.CENTER);
              Panel4.add(Panel5, BorderLayout.NORTH);
              Panel4.add(Panel6, BorderLayout.CENTER);
              Panel4.add(Panel7, BorderLayout.SOUTH);
              //Panel 8 Used to Display the Buttons
              Panel9.add(btn1, BorderLayout.CENTER);
              Panel9.add(btn2, BorderLayout.CENTER);
              Panel9.add(btn3, BorderLayout.SOUTH);
              Panel8.add(Panel9, BorderLayout.CENTER);
              //Setting Background, ForeGround and Font of all Text.
             Panel1.setBackground(color3);
             Panel2.setBackground(color3);
             Panel3.setBackground(color3);
             Panel4.setBackground(color3);
             Panel5.setBackground(color3);
             Panel6.setBackground(color3);
             Panel7.setBackground(color3);
             Panel8.setBackground(color3);
             Panel9.setBackground(color3);
             Panel10.setBackground(color3);
             btn1.setBackground(color3);
             btn2.setBackground(color3);
             btn3.setBackground(color3);
             radio1.setBackground(color3);
             radio2.setBackground(color3);
             btn1.setFont(font2);
             btn2.setFont(font2);
             btn3.setFont(font2);
             Combo1.setFont(font2);
             Combo1.setBackground(color3);
             Combo1.setForeground(color1);
             label1.setFont(font2);
             label2.setFont(font2);
             label3.setFont(font1);
             label4.setFont(font1);
             label1.setForeground(color2);
             label2.setForeground(color2);
             label3.setForeground(color1);
             label4.setForeground(color1);
             container.add(Panel10);
              //Setting Keyboard Shortcuts to Radio Buttons and Regular Buttons
              btn1.setMnemonic('S');
              btn2.setMnemonic('D');
              btn3.setMnemonic('E');
              radio1.setMnemonic('A');
              radio2.setMnemonic('C');
              //ActionListener
              btn1.addActionListener(new ActionListener()) {
                   public void actionPerformed(ActionEvent evt) {
                        btn1actions();
              private void btn1actions() {
                   if (radio1.isSelected()){ System.out.println("Radio Button 1 is selected. Button 1")};
                   if (radio2.isSelected()){ System.out.println("Radio Button 2 is selected. Button 1")};
              btn2.addActionListener(new ActionListener()) {
                   public void actionPerformed(ActionEvent evt) {
                                            btn2actions();
              private void btn2actions() {
                   if (radio1.isSelected()) System.out.println("Radio Button 1 is selected(Button 2).");
                   if (radio2.isSelected()) System.out.println("Radio Button 2 is selected.Button 2");
              btn3.addActionListener(new ActionListener()) {
                   public void actionPerformed(ActionEvent evt) {
                        btn1actions();
              private void btn3actions() {
                   txt1.setText("");
                   txt1.requestFocus();
         public static void main(String[] args) {
             JavaCollegeTest2 frame = new JavaCollegeTest2();
             frame.setTitle("Project 4");
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             frame.setSize(400, 300);
             frame.setLocation(400,400);
             frame.setVisible(true);
    }

  • Help with mutating trigger

    Hi all,
    I have a trigger shown below is gives me the mutating error.
    The error is to do with the select from the payments table (which it does not allow cos of the mutating effect).
    Can anyone give me some ideas on how I can resolve this?
    Thank you very much
    create or replace
    TRIGGER CHECK_INVOICE_PAID_IN_FULL AFTER
    UPDATE OF "PAYMENT_STATUS" ON "PAYMENTS" FOR EACH ROW
    DECLARE
    -- check if all the payments for that invoice have been received (completed)
    -- if they are complete then sum all the payments for that invoice and compare to gross value on invoices
    v_invoice_amount NUMBER;
    v_gross_amount NUMBER;
    thisproc CONSTANT VARCHAR2(80) := 'trap_errmesg for mco_transfer_status';
    v_value VARCHAR2(150);
    BEGIN
    -- Changed as requested by nicola on 12/09/05 IF :NEW.PAYMENT_COMPLETE is not null
    IF :NEW.PAYMENT_STATUS='C' AND :NEW.PAYMENT_STATUS <> :OLD.PAYMENT_STATUS
    THEN
    -- We will sum all the payments for that invoice that have a value in payment_complete
    SELECT NVL(SUM(amount),0) INTO v_invoice_amount FROM payments WHERE payment_complete IS NOT NULL AND invoice_id=:NEW.INVOICE_ID;
    -- We will also get the gross amount for the invoice to compare to the sum of the payments
    SELECT NVL(gross,0) INTO v_gross_amount FROM invoices WHERE
    invoice_id = :NEW.INVOICE_ID ;
    END IF;
    IF v_invoice_amount = v_gross_amount
    THEN
    UPDATE invoices SET paid_date=SYSDATE;
    END IF;
    END CHECK_INVOICE_PAID_IN_FULL;
    /

    Hi Anwar,
    Thanks for this.
    Can you please help me out here
    I did the bit with creating a temporay table to hold the invoice_ids and then created a procedure that will be fired by the trigger, however because of the clause
    IF :NEW.PAYMENT_STATUS='C' AND :NEW.PAYMENT_STATUS <> :OLD.PAYMENT_STATUS
    I cant use a statement level trigger for this procedure and when i use the row level trigger i get the mutating error.
    here is what i have got so far.
    A temporary table which holds the invoice_ids (this is called payments_temp)
    I then created a trigger as below which populates this temp table
    TRIGGER insert_payments_temp BEFORE
    UPDATE OF "PAYMENT_STATUS" ON "PAYMENTS" FOR EACH ROW
    DECLARE
    -- check if all the payments for that invoice have been received (completed)
    -- if they are complete then sum all the payments for that invoice and compare to gross value on invoices
    v_invoice_amount NUMBER;
    v_gross_amount NUMBER;
    thisproc CONSTANT VARCHAR2(80) := 'trap_errmesg for mco_transfer_status';
    v_value VARCHAR2(150);
    BEGIN
    INSERT INTO payments_temp
    VALUES (:NEW.invoice_id);
    END insert_payments_temp;
    Then I created a procedure below which will do the update
    PROCEDURE "CHECK_INVOICE_PAID_IN_FULL_PRO" IS
    -- check if all the payments for that invoice have been received (completed)
    -- if they are complete then sum all the payments for that invoice and compare to gross value on invoices
    v_invoice_amount NUMBER(20);
    v_gross_amount NUMBER;
    thisproc CONSTANT VARCHAR2(80) := 'trap_errmesg for mco_transfer_status';
    v_value VARCHAR2(150);
    BEGIN
    -- We will sum all the payments for that invoice that have a value in payment_complete
    --select sum(amount) into v_invoice_amount from payments where payment_complete is not null and invoice_id=:NEW.INVOICE_ID;
    FOR x IN (SELECT invoice_id FROM payments_temp) LOOP
    SELECT NVL(SUM(amount),0) INTO v_invoice_amount FROM payments
    WHERE payment_complete IS NOT NULL AND invoice_id=X.INVOICE_ID;
    SELECT NVL(gross,0) INTO v_gross_amount FROM INVOICES WHERE
    invoice_id = X.INVOICE_ID ;
    END LOOP;
    -- We will also get the gross amount for the invoice to compare to the sum of the payments
    IF v_invoice_amount = v_gross_amount
    THEN
    UPDATE INVOICES SET paid_date=SYSDATE;
    COMMIT;
    END IF;
    END CHECK_INVOICE_PAID_IN_FULL_PRO;
    Then finally the update trigger itself below
    TRIGGER "NICKC"."CHECK_INVOICE_PAID_IN_FULL" AFTER
    UPDATE OF "PAYMENT_STATUS" ON "NICKC"."PAYMENTS" FOR EACH ROW
    DECLARE
    -- check if all the payments for that invoice have been received (completed)
    -- if they are complete then sum all the payments for that invoice and compare to gross value on invoices
    v_invoice_amount NUMBER;
    v_gross_amount NUMBER;
    thisproc CONSTANT VARCHAR2(80) := 'trap_errmesg for mco_transfer_status';
    v_value VARCHAR2(150);
    BEGIN
    -- Changed as requested by nicola on 12/09/05 IF :NEW.PAYMENT_COMPLETE is not null
    IF :NEW.PAYMENT_STATUS='C' AND :NEW.PAYMENT_STATUS <> :OLD.PAYMENT_STATUS
    THEN
    CHECK_INVOICE_PAID_IN_FULL_PRO;
    END IF;
    END CHECK_INVOICE_PAID_IN_FULL;
    However i still get the mutating error message and when i try to create a statemtnet level trigger i get the message say cannot use :NEW and :OLD values here.
    Please help

  • URGENT : Trigger with Mutating Error

    Hi,
    I'm trying to write a trigger on a Table ROOM_BLOCK to update a value in table ROOM_OOI_OOS.
    As given below, which works perfectly.
    BEGIN
    IF INSERTING THEN
    IF NVL(:NEW.ROOM_OOI_OOS_ID,0) <> 0 THEN
    UPDATE ROOM_OOI_OOS SET NO_OF_ROOMS = NVL(NO_OF_ROOMS,0)+1
    WHERE ROOM_OOI_OOS_ID = :NEW.ROOM_OOI_OOS_ID;
    END IF;
    ELSIF UPDATING THEN
    IF NVL(:OLD.ROOM_OOI_OOS_ID,0) <> 0 THEN
    UPDATE ROOM_OOI_OOS SET NO_OF_ROOMS = NVL(NO_OF_ROOMS,0)-1
    WHERE ROOM_OOI_OOS_ID = :OLD.ROOM_OOI_OOS_ID;
    END IF;
    IF NVL(:NEW.ROOM_OOI_OOS_ID,0) <> 0 THEN
    UPDATE ROOM_OOI_OOS SET NO_OF_ROOMS = NVL(NO_OF_ROOMS,0)+1
    WHERE ROOM_OOI_OOS_ID = :NEW.ROOM_OOI_OOS_ID;
    END IF;
    ELSE
    IF NVL(:OLD.ROOM_OOI_OOS_ID,0) <> 0 THEN
    UPDATE ROOM_OOI_OOS SET NO_OF_ROOMS = NVL(NO_OF_ROOMS,0)-1
    WHERE ROOM_OOI_OOS_ID = :OLD.ROOM_OOI_OOS_ID;
    END IF;
    END IF;
    END;
    But when I add a select statement. the trigger seems to fail with a mutating error ORA-04091
    and Error at Line which executes the statement immidiate ORA-04088.
    DECLARE
    stmt VARCHAR2(500);
    vcount INTEGER;
    BEGIN
    IF INSERTING THEN
    --INSERT INTO SHRUTI_TEST (DESCR) VALUES ('Inserting');
    IF NVL(:NEW.ROOM_OOI_OOS_ID,0) <> 0 THEN
    stmt := 'Select count(*) from ROOM_BLOCK ' ||
    ' WHERE ROOM_OOI_OOS_ID = ' || :NEW.ROOM_OOI_OOS_ID ||
    ' AND ROOM_NO = ''' || :NEW.ROOM_NO || ''' ';
    EXECUTE IMMEDIATE stmt INTO vcount;
    IF vcount = 1 THEN
    UPDATE ROOM_OOI_OOS SET NO_OF_ROOMS = NVL(NO_OF_ROOMS,0)+1
    WHERE ROOM_OOI_OOS_ID = :NEW.ROOM_OOI_OOS_ID;
    END IF;
    END IF;
    ELSIF UPDATING THEN
    IF NVL(:OLD.ROOM_OOI_OOS_ID,0) <> 0 THEN
    UPDATE ROOM_OOI_OOS SET NO_OF_ROOMS = NVL(NO_OF_ROOMS,0)-1
    WHERE ROOM_OOI_OOS_ID = :OLD.ROOM_OOI_OOS_ID;
    END IF;
    IF NVL(:NEW.ROOM_OOI_OOS_ID,0) <> 0 THEN
    UPDATE ROOM_OOI_OOS SET NO_OF_ROOMS = NVL(NO_OF_ROOMS,0)+1
    WHERE ROOM_OOI_OOS_ID = :NEW.ROOM_OOI_OOS_ID;
    END IF;
    ELSE
    IF NVL(:OLD.ROOM_OOI_OOS_ID,0) <> 0 THEN
    UPDATE ROOM_OOI_OOS SET NO_OF_ROOMS = NVL(NO_OF_ROOMS,0)-1
    WHERE ROOM_OOI_OOS_ID = :OLD.ROOM_OOI_OOS_ID;
    END IF;
    END IF;
    END;
    Please tell me how to solve this problem...
    Regards
    Mike.

    Thank you for your reply to my posting.
    I researched and used your recommendation. I was
    wondering if you can help me resolve the following two
    problems.
    Table kassa1 has NAME and AGE columns. Table Kassa2
    has one column Age.
    I have created the following trigger. It keeps
    raising a ORA-06519 : Active autonomous transaction
    detected and rolled back error.
    Create or replace trigger Name_Age_Row after insert or
    update on Kassa1
    For each row
    Declare
    Total_Age VARCHAR(8);
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
         Select SUM(Age) into Total_Age from Kassa1;
         insert into kassa2 values(Total_aAge);
    End;     
    The following trigger also generates ORA-00036:
    Maximum number of recursive SQL levels(50) exceeded
    error.
    Create or replace trigger Name_Age_Row after insert or
    update on Kassa1
    For each row
    Declare
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
         insert into kassa1 values('newname', 'newage');
    End;     

  • Azure Sql DB Export to Storage Container fails with "An error occurred while sending the request"

    I've built a new VM from which I'm running PowerShell scripts to backup my databases.  It had worked before on an old server for several months, and worked once on the new server, then I upgraded my Azure PowerShell cmdlets, and haven't been able to
    get it to work again.  The new version is 0.8.10.1.
    Below is my source code, with sensitive stuff replaced with ?'s.  When I display the $stctx and $dbctx, they seem to have reasonable values.  I added the IP address of the server as an exception to the db firewall, and I've installed SQL Server
    Mangement Studio and verified that I can connect to the database.  I have a feeling there's something simple I've overlooked.
    Here's are both error messages:
    Start-AzureSqlDatabaseExport : An error occurred while sending the request.
    At C:\Users\Public\PublicCmds\test.ps1:29 char:1
    + Start-AzureSqlDatabaseExport -SqlConnectionContext $dbctx -StorageContext $stctx ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Start-AzureSqlDatabaseExport], HttpRequestException
        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet.StartAzureSqlDatabaseExport
    Start-AzureSqlDatabaseExport : Error while copying content to a stream.
    At C:\Users\Public\PublicCmds\test.ps1:29 char:1
    + Start-AzureSqlDatabaseExport -SqlConnectionContext $dbctx -StorageContext $stctx ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Start-AzureSqlDatabaseExport], HttpRequestException
        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet.StartAzureSqlDatabaseExport
    Here is the source code:
    param($dbname)
    if ($dbname -eq $null) {
    write-host "Database code must be specified"
    return
    $password = "????"| ConvertTo-SecureString -asPlainText -Force
    $servercredential = new-object System.Management.Automation.PSCredential("????", $password) 
    $dbsize = 1
    $dbrestorewait = 10
    $dbserver = "????"
    $stacct = $dbname
    $stkey = "????"
    $stctx = New-AzureStorageContext -StorageAccountName $stacct -StorageAccountKey $stkey
    $dbctx = New-AzureSqlDatabaseServerContext -ServerName $dbserver -Credential $servercredential 
    $dt = Get-Date
    $timestamp = "_" + $dt.Year + "-" + ("{0:D2}" -f $dt.Month) + "-" + ("{0:D2}" -f $dt.Day) + "-" + ("{0:D2}" -f $dt.Hour) + ("{0:D2}" -f $dt.Minute)
    $bkupname = $dbname + $timestamp + ".bacpac"
    write-host "db context"
    $dbctx
    write-host "storage context"
    $stctx
    write-host "Backup $dbname to $bkupname"
    Start-AzureSqlDatabaseExport -SqlConnectionContext $dbctx -StorageContext $stctx -StorageContainerName databasebackup -DatabaseName $dbname -BlobName $bkupname

    Hi Brad,
    Mentioned script, with appropriate values, works on my system.
    I'm able to export an Azure SQL database to blob storage. Am using version 0.8.10.1 of cmdlets, so this the same version mentioned in this problem description.
    Can you please try using Add-AzureAccount and check if that helps. This is indicated in a different third-party blog.
    http://answers.flyppdevportal.com/categories/azure/azuretroubleshooting.aspx?ID=8aee89fe-430e-45fe-af54-7c8ed3ac60e1%29."http://answers.flyppdevportal.com/categories/azure/azuretroubleshooting.aspx?ID=8aee89fe-430e-45fe-af54-7c8ed3ac60e1
    Does it work from a different machine with newly downloaded credentials.
    Does it work for a newly created database (so minimal database size).
    If above do not work, we may require additional details like RequestID, StorageAccountName, ServerName so an MS ticket may be more appropriate.
    Girish Prajwal

  • Need help with INSTEAD OF trigger on view

    Hi,
    I am trying to use INSTEAD OF on a view because I will be updating the calling table in my trigger, which will cause mutation. 
    I need to update attribute7 of another record based on the new attribute7 of the current record (record being updated in the form).  Below is my script.  My problem is it does not perform the update. 
    create or replace view xxont_oe_order_lines_vw as select * from oe_order_lines_all;
    CREATE OR REPLACE TRIGGER APPS.xxont_sync_ard
    instead of insert or update on xxont_oe_order_lines_vw
    referencing
    new as new
    old as old
    for each row
    begin
       update oe_order_lines_all
           set attribute7 = :new.attribute7
       where attribute18 = to_char(:new.header_id)
          and attribute17 = to_char(:new.line_id)
          and flow_status_code <> 'CANCELLED' ;      
      /*exception
      when others then
         null ;
      end ;*/        
    end ;

    Always make your code developer friendly. Do extensive code instrumentation. At lease you can do this.
    create or replace trigger apps.xxont_sync_ard
    instead of insert or update on xxont_oe_order_lines_vw
    referencing
    new as new
    old as old
    for each row
    declare
       zero_update exception;
    begin
       update oe_order_lines_all
          set attribute7 = :new.attribute7
        where attribute18 = to_char(:new.header_id)
          and attribute17 = to_char(:new.line_id)
          and flow_status_code <> 'CANCELLED' ;
       if sql%rowcount = 0 then
         raise zero_update;
       end if;
    exception
      when zero_update then
         raise_application_error
               -20001
             , 'OE_ORDER_LINES_ALL: 0 rows updated attribute18 = "'
               || attribute18
               || '" attribute17 = "'
               || to_char(:new.line_id)
               || '"'
    end ;
    This will help you raise error when the update does not update any row. This is just an example, make sure if this is what your requirement wants if you want to implement it. If you don't want to raise error then you can just log it in a log table or log file.

  • Help with SIGSEGV error, please?

    Greetings,
    I have no idea what this error log means. It only happens on one computer, so it isn't the program. Something in the system is messed up. Can anyone tell what from this?
    # A fatal error has been detected by the Java Runtime Environment:
    #  SIGSEGV (0xb) at pc=0x00007fff840542db, pid=533, tid=36871
    # JRE version: 7.0_10-b18
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04 mixed mode bsd-amd64 compressed oops)
    # Problematic frame:
    # C  [libGL.dylib+0x22db]  glGetString+0xf
    # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
    http://pastie.org/8138651
    And where do I type "ulimit -c unlimited"? I typed it in Terminal, but nothing happened.
    Thanks

    Hi, I�m currently writing some code that requires me
    to read in a list of names and prices from a txt file
    then sort them, I have so far successfully created a
    menu and the code to read in my txt file "cars.txt"
    however it is returning me with an error, I need to
    sort this part out before I can move on to the
    sorting section, any help would be much appreciated,
    James
    C:\Documents and Settings\James\Desktop\lateast
    java\carprogramjames.java:54: unreported exception
    java.io.FileNotFoundException; must be caught or
    declared to be thrown
              Scanner scan = new Scanner (myFile);
              ^
    1 error
    Tool completed with exit code 1Do it like this:
    public void ReadCarsAndPricesFromFile() throws FileNotFoundException {
    }orpublic void ReadCarsAndPricesFromFile() {
        try {
            Scanner scan = new Scanner (myFile);
        } catch(FileNotFoundException  fnfe) {
            fnfe.printStackTrace();
    }Details:
    http://java.sun.com/docs/books/tutorial/essential/exceptions/
    And also take the time to read this:
    http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
    Good luck.

  • Need help with resolving error

    Hi,
    I am working on an ADF aaplication Each time I hit the execute button on my application I get the following error message,
    JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-35007: Row currency has changed since the user interface was rendered. The expected row key was null
    JBO-35007: Row currency has changed since the user interface was rendered. The expected row key was null
    Does anyone know why this come up? and what can I do to resolve this issue?
    Be very grateful to get a response soon.

    The page is suppose to be a search page, you could key in all the information in all the fields, but not mandatory. when I run the seach and key the info, then hit execute, the first time it runs very fine, but if want to make a second search it come up with the error.
    I hope with this I could get some help.
    Thank you very much

  • Need help with Workflow Issue: One notification sending out non-stop email.

    Hi,
    We've created a custom PO Approval Workflow based on standard PO Approval Workflow and we've had this for a while now. Last week, we encountered an issue where the notification keeps on sending email to the Suppliers and Buyers. We found out that the particular notification_id in the WF_NOTIFICATIONS table keeps getting updated by the minute setting the MAIL_STATUS to INVALID then back to SENT then back to INVALID again and so on. We think that whatever is updating this table is the cause but up until now we haven't found what's updating it. Below are some information of our instance.
    Oracle Applications: 11.5.10.2
    Database: 10.2.0.4 64 bit
    OS: AIX
    Custom Workflow based on revision 115.127.11510.16
    Customizations:
    - Created custom notification XX_EMAIL_PO_PDF_SUPP based on EMAIL_PO_PDF_SUPP.
    - Created custom message XX_EMAIL_PO_PDF based on EMAIL_PO_PDF.
    - Added #WFM_CC to XX_EMAIL_PO_PDF.
    - Created custom attribute XX_PO_WF_EMAIL_PERFORMER and set as Performer to notification XX_EMAIL_PO_PDF_SUPP.
    - Created custom function XX_ADDTL_STARTUP_VAL right after function "Set Workflow Startup Values". This function sets #WFM_CC attribute and XX_PO_WF_EMAIL_PERFORMER attribute.
    Not sure if the customizations have anything to do with the issue since not all POs have this issue. Have anyone experience this? Would really appreciate any help with this.
    Thanks,
    Allen

    Kashif M wrote:
    Just review this thread, may help you
    Workflow Notification Mailer is Spamming the Email Accounts of Users [ID 1293792.1]
    thanksHi,
    This note has solved our issue. Hopefully they will release a fix for this as it is a common thing for us to change the email address of Supplier Site.
    Thanks,
    Allen

Maybe you are looking for

  • How to get the values multiple times for the specified element - ABAP IXML.

    Hi all,          i have requirement to get the values for the specified elements multiple times. eg:., if the element is used in the xml 4 times then i need to get all the 4 values.  here is the sample xml, <View mmRelease="6.30" mmVersion="2.0" mmTi

  • I've installed itunes for windows 7 64-bit, but then itunes says I haven't

    I've installed itunes on my new Windows 7 64-bit computer multiple times, but every time I plug in my iphone 5 I get a message saying I need to install itunes 64-bit. I've tried all the fixes I've found online to no avail. Anyone out there able to he

  • Can my voice be converted to text?

    I'm trying to read an essay instead of typing it. Can the Mac editor do that or do i need another app? thanks

  • Safari eating up 75% of CPU

    Hello, I would like to know if anyone has any suggestions on what is wrong with my browser. The past couple weeks Safari has slowed drastically and I can't really figure out why. I have emptied the cache, and deleted all of the favorite icons a few t

  • Why java is called as true object oriented language?

    HI Friends, Though few oops concepts is not supported , why java is called as truly object oriented language and C++ as not a purely object oriented language???? Please, if any one know , give me the answer. Thanks to all.