Error running Update SQL, which has a table join

I'm running oracle 10g.
I have two tables (described below):
notes table:
cust - varchar(10)
group -varchar(10)
opportunity_id - varchar (10)
activity table:
cust - varchar(10)
group - varchar(10)
i_ref_no - integer
i_vendor_control - varchar(15)
create_date - date
I want to update the first_name and last_name columns in the notes table with the first_name and last_name columns in the activity, while doing an inner join on the opportunity_id and i_vendor_control. Only update if first_name and last_name are both null in the notes table AND if the create date is greater than 1/1/13 in the activity table and the i_ref_no is between certain values.
Here's my SQL:
update notes
set (notes.i_cust, notes.i_grup) =
(select activity.i_cust, activity.i_grup
     from activity
where notes.opportunity_id = activity.i_vendor_control
     and activity.d_crea = '04/23/13'
     and activity.i_ref_no between 871206 and 871210)
where notes.i_cust IS NULL
and notes.i_grup IS NULL
and notes.opportunity_id in (select activity.i_vendor_control from activity
          where activity.d_crea = '04/23/13'
          and activity.i_ref_no between 871206 and 871210)
Can someone tell me why this SQL gets a syntax error? I can run the nested select statements separately and they work fine, but when i run this entire SQL, i get a syntax error. Can anyone see the syntax error? Or is there a better way to write this? All i'm doing is updating the first and last names in the first table with that of the second table.

I think this should suffice
update notes
set (notes.i_cust, notes.group) =
(select activity.i_cust, activity.group
from activity
where notes.opportunity_id = activity.i_vendor_control
and activity.create_date = '04/23/13'
and activity.i_ref_no between 871206 and 871210)
where notes.i_cust IS NULL
and notes.group IS NULL
and notes.opportunity_id in (select activity.i_vendor_control from activity
where activity.create_date = '04/23/13'
and activity.i_ref_no between 871206 and 871210)
Why do you need an extra clause with IN operator for the same where condition?
Is it because its not an update for the entire table? If so then have the outer clause using exists as it will perform better

Similar Messages

  • How can i export the data to excel which has 2 tables with same number of columns & column names?

    Hi everyone, again landed up with a problem.
    After trying a lot to do it myself, finally decided to post here..
    I have created a form in form builder 6i, in which on clicking a button the data gets exported to excel sheet.
    It is working fine with a single table. The problem now is that i am unable to do the same with 2 tables.
    Because both the tables have same number of columns & column names.
    Below are 2 tables with column names:
    Table-1 (MONTHLY_PART_1)
    Table-2 (MONTHLY_PART_2)
    SL_NO
    SL_NO
    COMP
    COMP
    DUE_DATE
    DUE_DATE
    U-1
    U-1
    U-2
    U-2
    U-4
    U-4
    U-20
    U-20
    U-25
    U-25
    Since both the tables have same column names, I'm getting the following error :
    Error 402 at line 103, column 4
      alias required in SELECT list of cursor to avoid duplicate column names.
    So How can i export the data to excel which has 2 tables with same number of columns & column names?
    Should i paste the code? Should i post this query in 'SQL and PL/SQL' Forum?
    Help me with this please.
    Thank You.

    You'll have to *alias* your columns, not prefix it with the table names:
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id, b.id, a.val1, b.val1, a.val2, b.val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
      for rData in cData loop
    ERROR at line 18:
    ORA-06550: line 18, column 3:
    PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names
    ORA-06550: line 18, column 3:
    PL/SQL: Statement ignored
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id a_id, b.id b_id, a.val1 a_val1, b.val1 b_val1, a.val2 a_val2, b.val2 b_val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
    PL/SQL procedure successfully completed.
    cheers

  • Get Error while update the User defined row table through DSK Code

    Hi experts,
    I have got an error while updating the user row defined table.
    Error is - "Invalid row"
    I have created one master table "@CBF_FARM " and Child table "@CBF_FAR1"
    First i inserted 5 record in the child table so in my my child table there are 5 Line id (1,2,3,4,5 one for each row).
    after that i delete 2 rows (3rd & 4th row) from child table now in my child table there are 3 rows( Line id 1, 2, 5). Please See attachment.
    Now i am updating  the last record of child table through Code  (Line id is 5)  from other form, then i got error  invalid row.
    Following Code used for updating the user defined child table.
      SAPbobsCOM.GeneralService oGeneralService1 = null;
                                    SAPbobsCOM.GeneralData oGeneralData1 = null;
                                    SAPbobsCOM.GeneralDataParams oGeneralParams1 = null;
                                    SAPbobsCOM.CompanyService sCmp1 = null;
                                    SAPbobsCOM.GeneralData oChild1 = null;
                                    SAPbobsCOM.GeneralDataCollection oChildren1 = null;
                                    sCmp1 = clsAddOn.LDNA_Company.GetCompanyService();
                                    oGeneralService1 = sCmp1.GetGeneralService("CBF_FARM");
                                    // Get UDO record
                                    oGeneralParams1 = ((SAPbobsCOM.GeneralDataParams)(oGeneralService1.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));
                                    oGeneralParams1.SetProperty("Code", oForm.Items.Item("edtFarmCd").Specific.Value);
                                    oGeneralData1 = oGeneralService1.GetByParams(oGeneralParams1);
                                    // Add lines on UDO Child Table
                                    oChildren1 = oGeneralData1.Child("CBF_FAR1");
                                    // Create data for rows in the child table
                                    SAPbouiCOM.Item oItem = oForm.Items.Item("cmbShed");
                                    oCombo = oItem.Specific;
                                    string ShedCode = oCombo.Selected.Value;
                                    ldna_Rec = clsAddOn.LDNA_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                                    string strQuery1 = "select LineId from [@CBF_FAR1] where U_ShedCd = " + ShedCode;
                                    ldna_Rec.DoQuery(strQuery1);
                                    oChild1 = oChildren1.Item(ldna_Rec.Fields.Item("LineId").Value - 1);
                                    oChild1.SetProperty("U_Status", "Ready For Schedule");
                                    //Update the UDO Record
                                    oGeneralService1.Update(oGeneralData1);
    Please Help me it is an urgent requirement,
    -Regards
    Vikas

    hi.
    Error is - "Invalid row"
    Now i am updating  the last record of child table through Code  (Line id is 5)  from other form, then i got error  invalid row.
    As per my knowledge
    What i understood is you have 5 lines and you are going to be update 5th line
    am i correct..
    while u are updating the line in child table
    you have to consider like this..
    line number         u have to update like
    1                                        0
    2                                        1
    3                                        2
    4                                        3
    5                                        4
    which means in child table treat
    line 1  as 0
    line 2 as  1
    line 5 as 4
    If you want to update the line 5 u have to mention 4 th line

  • Activation error on Multi Provider which has Non-cumulative Cube

    Hi,
    My company has upgraded the BI 7.0 from 3.5.
    It is working fine so far.
    But I met the below message and could not activate it when I generate the multi provider which has Non-cumulative Cube.
    Define the characteristics of the validity table for non-cumulatives (Message no. R7846)
    And then I checked the Single cube but Single cube has no error.
    I think this is program error and searched the notes in OSS but could not find.
    Does any expert know this issue?
    Thank you.

    Hi lee,
    validity slice tables need to be defined for cubes using non cumulative key figures.
    In this we need to specify the characteristic combination on which this table has be maintained.
    The maintanence can be done from cube change mode, menu bar extras--> maintain non cumulative values.
    This table constantly gets updated with validity dates as we upload data.
    An report on this can be seen in tcode RSDV.
    Naveen.A

  • How do i run a class which has too many dependencies/class/jar file

    i am very new in java environment, i have developed a class which has to many jar file, it works fun when i run it from ide but problem arise which i wanna run it from command promt like
    java classname
    here is my code
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.HashMap;
    import java.util.Map;
    import net.sf.jasperreports.engine.JRException;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperExportManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.view.JasperViewer;
    public class ReportViewer {
         public static void main(String[] args) {
              try {
                   JasperDesign jasperDesign = JRXmlLoader.load("EmpDeptReport.xml");
                   JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                   Map parameters = new HashMap();
                   parameters.put("Title", "JasperReport");
                   Connection conn = Database.getConnection();
                   JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
                             parameters, conn);
                   JasperExportManager.exportReportToPdfFile(jasperPrint, "Sebl_Statement.pdf");
                   JasperViewer.viewReport(jasperPrint);
              } catch (JRException e) {
                   e.printStackTrace();
              } catch (SQLException e) {
                   e.printStackTrace();
    so expert people , please help a novice people.
    [code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    If you place all of your extra .jar files into a "lib" folder in same folder as your jar file then you can call the java class easily using a script similar to.....
    #--------- runJava.bat file to call java program --------------------
    cp=.
    for f in lib/*.jar; do cp=$cp:$f; done
    java -cp $cp:PROGRAM_JAR_FILE.jar com.myclass.mainclass
    #--------- end script -------------
    This loops over the *.jar files in the lib folder and adds them to the classpath. Please note that ":" is used as a cp seperator since this script was run on linux.
    hth,
    Robin

  • Error while executing SQL query -' Must Specify Table to select from'

    Hi all,
    While executing query using query generator
    it shows error message
    [Microsoft][SQL Native Client][SQL Server]Must specify table to select from.
    2). [Microsoft][SQL Nativ
    SELECT T1.ItemCode, T1.Dscription AS 'Item Description', T1.Quantity, T1.Price, T1.LineTotal,
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=-90 AND T1.LineNum=T2.LineNum) as 'BEDAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=-60 AND T1.LineNum=T2.LineNum) as 'ECSAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=7 AND T1.LineNum=T2.LineNum) as 'HECSAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=1 AND T1.LineNum=T2.LineNum) as 'VATAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=4 AND T1.LineNum=T2.LineNum) as 'CSTAmt'
    FROM dbo.[OPCH] T0  INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN PCH4 T2 ON T2.DocEntry=T0.DocEntry
    WHERE T0.DocDate >='[%0]' AND  T0.DocDate <='[%1]' AND T0.DocType = 'I'
    GROUP BY T1.ItemCode,T1.Dscription,T1.Quantity, T1.Price, T1.LineTotal,T0.DocEntry,T1.DocEntry,T1.LineNum,T2.LineNum
    It's executing fine in MS SQL Server Studio Management.
    Please give y'r ideas to solve the problem.
    Jeyakanthan

    try this, it works fine in my B1:
    SELECT T1.ItemCode, T1.Dscription AS 'Item Description', T1.Quantity, T1.Price, T1.LineTotal,
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=-90 AND T1.LineNum=T2.LineNum) as 'BEDAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=-60 AND T1.LineNum=T2.LineNum) as 'ECSAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=7 AND T1.LineNum=T2.LineNum) as 'HECSAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=1 AND T1.LineNum=T2.LineNum) as 'VATAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=4 AND T1.LineNum=T2.LineNum) as 'CSTAmt'
    FROM dbo.OPCH T0  INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN PCH4 T2 ON T2.DocEntry=T0.DocEntry
    WHERE T0.DocDate >='[%0]' AND  T0.DocDate <='[%1]' AND T0.DocType = 'I'
    GROUP BY T1.ItemCode,T1.Dscription,T1.Quantity, T1.Price, T1.LineTotal,T0.DocEntry,T1.DocEntry,T1.LineNum,T2.LineNum
    B1 don't like brackets!
    Regards

  • Errors running catrep.sql ??

    Hi all,
    I install oracle 8.0.5 on my redhat 5.2 kernel 2.0.36 I run
    root.sh but when I run catrep.sql it gave errors like:
    CREATE UNIQUE INDEX system.repcat$_ddl ON
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    CREATE SEQUENCE system.repcat_log_sequence
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    CREATE SEQUENCE system.repcat_log_sequence
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    It succeeded most of the other tasks. what should I do ?
    Utku.
    null

    If you don't have any configuration worth saving do as follow
    cd $ORACLE_HOME/rdbms/admin
    svrmgrl sys/password (or connect internal)
    @catrepr
    @catrep
    This will remove all exisiting replication objects and
    re-create.
    Jaroslaw Sosnicki
    Tech. Staff Eng.
    Motorola, Inc.
    Utku Er (guest) wrote:
    : Hi all,
    : I install oracle 8.0.5 on my redhat 5.2 kernel 2.0.36 I run
    : root.sh but when I run catrep.sql it gave errors like:
    : CREATE UNIQUE INDEX system.repcat$_ddl ON
    : ERROR at line 1:
    : ORA-00955: name is already used by an existing object
    : CREATE SEQUENCE system.repcat_log_sequence
    : ERROR at line 1:
    : ORA-00955: name is already used by an existing object
    : CREATE SEQUENCE system.repcat_log_sequence
    : ERROR at line 1:
    : ORA-00955: name is already used by an existing object
    : It succeeded most of the other tasks. what should I do ?
    : Utku.
    null

  • Error while running a Query which has measures from both facts

    Hi Guys,
    I have three tables. 1 Dimension table D1 and two fact tables F1 and F2.
    D1 has columns ------> Accountid, Account Number
    F1 has Columns ------> Accountid,Current Balance1, Balance Type
    F2 has Columns ------> Accountid,Current Balance2
    Now i want to run a report like
    D1.Account Number,F1.Current Balance1,F2.Current Balance2, F1.Balance Type.
    When i run this Report then i am getting values only for F1.Current Balance1 and F2.Current Balance2 is Null.
    But when i remove F1.Balance Type from Query i am getting both F1.Current Balance1 and F2.Current Balance2.
    Can any one help me with this.
    Thanks
    Rondo.

    RONDO wrote:
    Hi Guys,
    I have three tables. 1 Dimension table D1 and two fact tables F1 and F2.
    D1 has columns ------> Accountid, Account Number
    F1 has Columns ------> Accountid,Current Balance1, Balance Type
    F2 has Columns ------> Accountid,Current Balance2
    Now i want to run a report like
    D1.Account Number,F1.Current Balance1,F2.Current Balance2, F1.Balance Type.
    When i run this Report then i am getting values only for F1.Current Balance1 and F2.Current Balance2 is Null.
    But when i remove F1.Balance Type from Query i am getting both F1.Current Balance1 and F2.Current Balance2.
    Can any one help me with this.
    Thanks
    Rondo.Run the report again and get the SQL from the log and run it in TOAD/(Any SQL Developer). Then check for the joins and filters in the SQL.
    Correct the joins and filters appropriately in the SQL to make sure you got it right before implementing the same changes in the RPD.
    Hope this helps.

  • Why do i get this error when i run my application which has one Business comp Frame

    I do have one application and a business component frame.
    I followed all the steps of how to create a workspace a project , application and a business component. But my application when it runs gives the following errors.
    This error is from the following statement in the Constructor of Frame
    Frame(){
    jbInit();
    //the above statement executes well
    sessionInfo.publishSession(executeQueriesNow);
    //the above statement gives the error shown below.
    null
    java.lang.NullPointerException
    void oracle.jbo.server.DBTransactionImpl.initTransaction()
    void oracle.jbo.server.DBTransactionImpl.<init>(java.lang.String, java.lang.String, java.lang.String)
    oracle.jbo.server.DBTransactionImpl oracle.jbo.server.DatabaseTransactionFactory.create(java.lang.String, java.lang.String, java.lang.String)
    void oracle.jbo.server.NullDBTransactionImpl.connect(java.lang.String, java.lang.String, java.lang.String)
    oracle.jbo.ApplicationModule oracle.dacf.dataset.SessionInfo._createAppModule()
    void oracle.dacf.dataset.SessionInfo.connect()
    void oracle.dacf.dataset.SessionInfo.openProducerObject()
    void oracle.dacf.dataset.ProducerObject.open(boolean)
    void oracle.dacf.dataset.SessionInfo.publishSession(boolean)
    void package22.Frame1.<init>()
    void package22.Application1.<init>()
    void package22.Application1.main(java.lang.String[])
    oracle.dacf.dataset.DataSourceOperationException: SessionInfo: Application module creation failed; className: MyProject9
    void oracle.dacf.dataset.ProducerObject.open(boolean)
    void oracle.dacf.dataset.SessionInfo.publishSession(boolean)
    void package22.Frame1.<init>()
    void package22.Application1.<init>()
    void package22.Application1.main(java.lang.String[])
    null

    I solved the problem. The invoked method was not part of the VO, but was part of the AM.

  • UPDATE SQL statement has poor performance

    Hi All,
    We have setup regular run background process,setup to "throttle"  user submitted
    Batch Requests to Batch Processing System.  Purpose of this "Throttle" DB level background
    process  (submitted using DBMS_SCHEDULER)  to check for currently active Requests and
    then accordingly (based on prevailing System Load)   inject new requests for Batch Request accordingly.
    This background process is scheduled to run every minute.
    We find that UPDATE statement below performs well when Table being updated (FRM_BPF_REQUEST)
    even when Table has upto 1 million rows.  (Expected Production volume)  UPDATE takes only few seconds  (< 10 secs)
    at most to execute
    However, we find that when there is a burst of INSERTS happening to  same Table  (FRM_BPF_REQUEST)
    via another database session,  UPDATE statement suffers with severe degradation.  Same UPDATE which used
    to perform  in matter of few seconds, takes upto  40 minutes when heavy INSERTS are happenning to
    Table.  We are trying to understand why Performance gets severely degraded when INSERTS are heavy on the Table,
    Any thoughts or insights into issue would be greatly appreciated.
    We are using Oracle DB 11.2.0.3.4  (on Linux)
    CREATE OR REPLACE PROCEDURE BPF_DISPATCH_REQUEST_SP(V_THROTTLE_SIZE NUMBER DEFAULT 600) AS
    --    Change History
    --001 -Auro    -10/09/2013  -Initial Version
    --    v_throttle_size    NUMBER DEFAULT 600;
          v_active_cnt         NUMBER DEFAULT 0;
          v_dispatched_cnt   NUMBER DEFAULT 0;
        v_start_time    TIMESTAMP := SYSTIMESTAMP;
        v_end_time    TIMESTAMP;
            v_subject_str   VARCHAR2(100) := '';
            v_db_name       VARCHAR2(20) := '';
      BEGIN
        -- Determine Throttle Size
        SELECT THROTTLE_SIZE
        INTO   v_throttle_size
        FROM   FRM_BPF_REQUEST_CONTROL;
        -- Determine BPF Active Request Count
        SELECT COUNT(*)
        INTO   v_active_cnt
        FROM   FRM_BPF_REQUEST
        WHERE  STATUS IN('rm_pending','rm_ready','processing','worker_ready','failed','dependency_failed','recover_ready');
        IF v_active_cnt < v_throttle_size THEN
            UPDATE FRM_BPF_REQUEST
            SET    STATUS='dispatched'
            WHERE  ID IN (
                    SELECT ID FROM (
                   SELECT ID
                   FROM   FRM_BPF_REQUEST
                   WHERE  STATUS='new'
                   ORDER BY ID
                    ) WHERE ROWNUM <= (v_throttle_size - v_active_cnt)
            v_dispatched_cnt := SQL%ROWCOUNT;
            COMMIT;
        END IF;
         v_end_time := SYSTIMESTAMP;
        INSERT INTO FRM_BPF_REQUEST_DISPATCH_LOG
        VALUES (
            v_start_time,   
            v_active_cnt,
            v_dispatched_cnt,
            v_end_time,
            NULL
        COMMIT;
        EXCEPTION
                  WHEN OTHERS THEN
                ROLLBACK;
             v_end_time := SYSTIMESTAMP;
            INSERT INTO FRM_BPF_REQUEST_DISPATCH_LOG
            VALUES (
                v_start_time,   
                v_active_cnt,
                v_dispatched_cnt,
                v_end_time,
                NULL
            COMMIT;
                SELECT ORA_DATABASE_NAME
            INTO   v_db_name
            FROM   DUAL;
                   v_subject_str := v_db_name||' DB: Fatal Error in BPF Request Dispatch Process';
            -- Alert Support                   
                DBA_PLSQL.SEND_MAIL(P_RECIPIENTS     => '[email protected]',
                                        P_CC         => '[email protected]',
                                            P_BCC         => '[email protected]',
                                            P_SUBJECT         => v_subject_str,
                                            P_BODY         => SUBSTR(SQLERRM, 1, 250));
    END;
    show errors
    Thanks
    Auro

    What the heck is this:
      EXCEPTION
                  WHEN OTHERS THEN
                ROLLBACK;
             v_end_time := SYSTIMESTAMP;
            INSERT INTO FRM_BPF_REQUEST_DISPATCH_LOG
            VALUES (
                v_start_time,   
                v_active_cnt,
                v_dispatched_cnt,
                v_end_time,
                NULL
            COMMIT;
                SELECT ORA_DATABASE_NAME
            INTO   v_db_name
            FROM   DUAL;
                   v_subject_str := v_db_name||' DB: Fatal Error in BPF Request Dispatch Process';
            -- Alert Support                   
                DBA_PLSQL.SEND_MAIL(P_RECIPIENTS     => '[email protected]',
                                        P_CC         => '[email protected]',
                                            P_BCC         => '[email protected]',
                                            P_SUBJECT         => v_subject_str,
                                            P_BODY         => SUBSTR(SQLERRM, 1, 250));
    Why are you programming for failure to succeed, willing to accept time taking rollbacks, committing afterward, fooling with transactions, swallowing/hiding all errors, all that 'nice and safely hidden' in the notorious WHEN OTHERS exception NOT followed by a RAISE?
    Only catch errors you expect.
    Programming to let a program fail is to fail.

  • Getting errors when updating a column on a table having a primary key

    Hi,
    I have an application on Oracle APEX that raises the following error after an attempt (through the application) to update a column with no specific constraint on it:
    ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignoredUnable to fetch row.
    The involved table has a primary key conatraint and the corresponding column can be populated by a sequence (but there is no trigger to manipulate the sequence).
    The sequence is mentioned in the involved page definition for populating the primary key.
    If I disable the primry key and set to null the corresponding value for the primary of the record to be updated, then it is possible to update that record (thus the above column) through the application.
    Did someone encountered this situation before?
    If yes, what was then your workaround/solution?
    Kind Regards.

    Dear user8058501 ,
    Firstly) Did you check
    Auto Row Fetch (After upgrade to 4.0.1)
    Automated Row Fetch on Table with Synonym causes ORA-00936: missing expr.
    Secondly) If the problem is not resolved, Would you provide a sample on apex.oracle.com with workspace/developer account to be able to help you
    Please, if this solves your question, mark it as Correct. Otherwise as helpful.
    Best Regards
    Mahmoud

  • SAOP Error running PL/SQL tutorial

    I am trying to step through the "Publish PL/SQL as Web Service" tutorial. Every thing works as expected until I reach step 28/29 in the tutorial. I get this exception (I have changed the application name a bit):
    [SOAPException: faultCode=SOAP-ENV:Server; msg=[SOAPException: faultCode=SOAP-ENV:Server; msg=]]
         void mypackage1.PLSQLWebServiceCompanyWebServiceStub.addemp(PLSQLWebService.Employee)
              PLSQLWebServiceCompanyWebServiceStub.java:163
    Debugging the code I see the exception is generede here:
    Response response = call.invoke(endpointURL, "");
    if (!response.generatedFault())
    Parameter result = response.getReturnValue();
    else
    Fault fault = response.getFault();
    throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
    Enviroment JDev 9.0.3 OC4J 9.0.3 on same W2K machine.
    Any suggestions?
    Thanks
    Flemming G. Jensen
              PLSQLWebServiceCompanyWebServiceStub.java:58
    Process exited with exit code 0.

    Hi Mike,
    I was in fact using the wrong jdk, since I start OC4J from a disk-top bat-file. I am aware of the unique key constraint and actions against that.
    However, correcting java version from 1.3.1_01 to 1.3.1_02 did not make the program run. I still get the same exception from OC4J. I get these messages when I deploy to OC4J
    ---- Deployment started. ---- May 17, 2003 3:45:33 PM
    Wrote WAR file to C:\JSource\PLSQLWebService\PLSQL\Compagny\WebServices.war
    Wrote EAR file to C:\JSource\PLSQLWebService\PLSQL\Compagny\PLSQL-Compagny-WS.ear
    Invoking OC4J admin tool...
    C:\jdev903\jdk\bin\javaw.exe -jar C:\jdev903\j2ee\home\admin.jar ormi://DK0001FGJREMOTE/ admin **** -deploy -file C:\JSource\PLSQLWebService\PLSQL\Compagny\PLSQL-Compagny-WS.ear -deploymentName PLSQL-Compagny-WS
    Auto-unpacking C:\jdev903\j2ee\home\applications\PLSQL-Compagny-WS.ear... done.
    Auto-unpacking C:\jdev903\j2ee\home\applications\PLSQL-Compagny-WS\WebServices.war... done.
    Auto-deploying PLSQL-Compagny-WS (Assembly had been updated)...
    Error initializing data-source 'jdbc/dk0002ocladis1pCoreDS': DriverManagerDataSource driver 'com.ddtek.jdbc.sqlserver.SQLServerDriver' not found
    Error initializing data-source 'jdbc/dk0002ocladis1pCoreDS': DriverManagerDataSource driver 'com.ddtek.jdbc.sqlserver.SQLServerDriver' not found
    Exit status of OC4J admin tool (-deploy): 0
    C:\jdev903\jdk\bin\javaw.exe -jar C:\jdev903\j2ee\home\admin.jar ormi://DK0001FGJREMOTE/ admin **** -bindWebApp PLSQL-Compagny-WS WebServices http-web-site /PLSQL-Compagny-context-root
    Exit status of OC4J admin tool (-bindWebApp): 0
    Use the following context root(s) to test your web application(s):
    http://DK0001FGJREMOTE:8888/PLSQL-Compagny-context-root
    Elapsed time for deployment: 12 seconds
    ---- Deployment finished. ---- May 17, 2003 3:45:45 PM
    To me it says that deployment goes fine. Perhaps the problem is caused by the errors I get when OC4J is initializing the datasources. For evaluation purposes I have testet DataDirects JDBC drivers. I have looked over all oc4j xml files and JDev configurations files for these datasources, but I cannot locate them.
    Remark the linie in the exception thrown by OC4J
    java.lang.NullPointerException
    oracle.jdbc.driver.OracleStatement oracle.jdbc.driver.LRUStatementCache.
    searchExplicitCache(java.lang.String)
    LRUStatementCache.java:654
    Has it something to do with this?
    Regards
    Flemming

  • Running a procedure which has parameters using dbms_job.submit

    I have a procedure which accepts some parameter and i need to schedule this using dbms_job in another procedure. My intention is to execute test_proc without waiting for test_asynch_proc
    CREATE or REPLACE PROCEDURE test_asynch_proc(p_1 in number) as
    i number;
    BEGIN
    for i in 1.. 100000
    loop
         insert into item_p values (dbms_random.random, p_1,sysdate);
    end loop;
    commit;
    END;
    I have another procedure which does an asynchronous call to this procedure by scheduling this procedure.
    create or replace procedure test_proc is
    jobno binary_integer;
    --x number :=100;
    begin
         insert into test_table values(1,sysdate);
         dbms_job.submit(job => jobNo,
         what=>'test_asynch_proc(''100'');',
         next_date=>sysdate );
    commit;
    dbms_output.put_line ('insert complete at '|| to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS'));
    end;
    but here instead of
    what=>'test_asynch_proc(''100'');'
    i need to give a variable. How can i do that?
    Thanks,
    mv

    There is another possibility where job parameters are stored in a parameter table with the job number that can be retrieved by the job code:
    bas002>
    bas002> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    bas002>
    bas002> drop table t;
    Table dropped.
    bas002> drop table p;
    Table dropped.
    bas002>
    bas002> create table t(x int,d date);
    Table created.
    bas002> create table p(jn int, jp int);
    Table created.
    bas002>
    bas002>
    bas002> create or replace procedure test_asynch_proc as
      2  begin
      3  insert into t select jp, (select sysdate from dual)
      4   from p where jn = sys_context('USERENV','BG_JOB_ID');
      5  commit;
      6  end;
      7  /
    Procedure created.
    bas002> show errors
    No errors.
    bas002>
    bas002> create or replace procedure test_proc (tp number) is
      2  jobno binary_integer;
      3  begin
      4  dbms_job.submit(
      5   job => jobno,
      6   what=>'test_asynch_proc;',
      7   next_date=>sysdate );
      8   insert into p values(jobno, tp);
      9  commit;
    10  end;
    11  /
    Procedure created.
    bas002> show errors
    No errors.
    bas002>
    bas002> alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
    Session altered.
    bas002> select sysdate from dual;
    SYSDATE
    28-FEB-2008 10:40:13
    bas002>
    bas002> exec test_proc(1);dbms_lock.sleep(5);
    PL/SQL procedure successfully completed.
    bas002> select * from t;
             X D
             1 28-FEB-2008 10:40:17
    bas002> exec test_proc(2);dbms_lock.sleep(5);
    PL/SQL procedure successfully completed.
    bas002> select * from t;
             X D
             1 28-FEB-2008 10:40:17
             2 28-FEB-2008 10:40:22Message was edited by:
    Pierre Forstmann
    Message was edited by:
    Pierre Forstmann

  • Error in the proc which has dynamic query in it.

    I have a proc as below
    create or replace procedure dynamic_Sql
    (id in number,
    obj_id in number,
    id2);
    is
    xxxx varchar2(30);
    sql_stmt1 VARCHAR2(10000);
    cusor c is select distinct dep from department where dept_id = 10;
    Beign
    select table_name into xxxx from tableq;
    for cur in c loop
    sql_stmt1:= 'insert into node(NODE_ID,pID,dep,tnode,PNODE)
    select id,pid2,cur.dep,null,null)
    from tablex h
    where h.hid = id2
    and h.dep = cur.dep)';
    end loop;
    execute immediate sql_stmt1;
    end;
    Here when i execute it is giving the error in 'id2' which is paased as the parameter in this proc and "cur.dep" which is comming from the cursor. It giving n error 'id2' and "cur.dep" is an invalid identifier
    Edited by: user10285699 on May 1, 2009 1:09 AM

    Your code is faulty.
    First of all you set up multiple statements in a cursor for loop, and you execute that statement outside the cursor for loop. So only 1 statement is executed.
    Secondly, you can't refer to pl/sql variables in a dynamic sql statement or you must use them as bind variables (preferred) or concatenate them.
    1 bind variables.
    sql_stmt1:= 'insert into node(NODE_ID,pID,dep,tnode,PNODE)
    select id,pid2,cur.dep,null,null)
    from tablex h
    where h.hid = :id2
    and h.dep = :dep';
    execute immediate sql_stmt1 using id2, cur.dep;
    end loop;
    2 concatenation.
    sql_stmt1:= 'insert into node(NODE_ID,pID,dep,tnode,PNODE)
    select id,pid2,cur.dep,null,null)
    from tablex h
    where h.hid = '||id2
    and h.dep = '||cur.dep||')';
    execute immediate sql_stmt1 using id2, cur.dep;
    end loop;
    Sybrand Bakker
    Senior Oracle DBA

  • Error running htmldbins.sql script in a HTML DB installation

    Hi !
    I did all the pre-install specified in the documentation. the script htmldbins.sql fails when the following error occurs:
    VI. I N S T A L L F L O W S
    define "^" (hex 5e)
    ...design time flows
    begin wwv_flow.g_import_in_progress := true; end;
    ERROR at line 1:
    ORA-04063: package body "FLOWS_010600.WWV_FLOW" has errors
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at line 1
    RDBMS Version: 10.1.0.2
    Operating System and Version: Windows 2003
    Product Version: HTML DB 1.6
    Anybody knows what´s happening ?
    Regards
    Eduardo P. Niel
    OCP Oracle
    Brazil

    I think this thread is something you should look at:
    Windows 10G HTMLDB Install Error
    Denes Kubicek

Maybe you are looking for

  • Business service and business system

    Can someone please tell me what is the difference between business service and business system and in which cases are they used respectively?

  • Is it possible to grant datasource resume actions to the Operator role?

    Hi gurus, I'm trying to grant the JDBC datasource suspend/resume action to the 'Operator' role. I understand this is an admin task and the 'Operator' role cannot do this. I've tried to edit weblogic.management.runtime -> JDBCDataSourceRuntime -> susp

  • How to compile servlet with Edit Plus?

    Hi I am writing a Java servlet in EditPlus and am wondering how to include the servlet.jar file so that EditPlus knows where the javax.servlet.*, etc classes are. I suppose this is an EditPlus specific question so sorry about that but I didn't know w

  • No XML generated for service PO when its saved-MM-SUS Service Procurement

    Hi, We have SRM 7.0 & EHP 6.0 (service pack 4) .  integrating using PI 7.0 The settings are in place as per the below SAP Notes: Note 1286936 - PI configuration for SRM - additional information Note 1268336 - Business Suite 2008: Synchronous peer-to

  • MacBook Pro Retina 13 vs 15 inch

    Hi, I am a high school student and I am going to get a MacBook Pro retina but cannot decide what size is right for me. I need it for typing essays and assignments, Internet surfing, YouTube, facebook, etc. and light video and photot editing. I am eit