Overriding insert error in PL/SQL

Hi all,
I have a piece of PL/SQL code that will insert data into a table in a loop.
Because of some data inconsistency in my original data table, this PL/SQL code does not run at all.
How do I override the errors?
By overriding what I mean is that my procedure should not stop at the first point of inconsistancy.
I dont want to insert inconsistant rows, but all consistant rows must be inserted.
Again I want to show the details of the no of rows not inserted while running the procedure. How do I do that.
for eg: 30 Rows Inserted, 20 rows dropped!
Thanks in advance.

The following piece of code will insert all the proper data and reject unsupported data till the end -
DECLARE
  TYPE EMP_REC IS TABLE OF EMP%ROWTYPE INDEX BY BINARY_INTEGER;
  EMP_TAB EMP_REC;
  CURSOR C1
  IS
    SELECT EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO,CODE
    FROM E_EMP;
  CTR  VARCHAR2(30);
  CTR2 VARCHAR2(300);
BEGIN
  OPEN C1;
  LOOP
    FETCH C1 BULK COLLECT INTO EMP_TAB;
    FORALL I IN 1..EMP_TAB.COUNT SAVE EXCEPTIONS
      INSERT INTO EMP VALUES EMP_TAB(I);
     EXIT WHEN C1%NOTFOUND;
  END LOOP;
  CLOSE C1;
EXCEPTION
  WHEN OTHERS THEN
    FOR i IN 1 .. SQL%BULK_EXCEPTIONS.COUNT LOOP
         dbms_output.put_line(SQL%BULK_EXCEPTIONS(i)
                              .ERROR_INDEX || ' : ' ||
                              SQLERRM(-1 * SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
    CTR := SQL%BULK_EXCEPTIONS(i).ERROR_INDEX;
    CTR2 := -1 * SQL%BULK_EXCEPTIONS(i).ERROR_CODE;
    INSERT INTO EMP_AUD VALUES(CTR,CTR2);
    END LOOP;
     DBMS_OUTPUT.PUT_LINE('NUMBER OF INSERT STATEMENT FAILED : '||SQL%BULK_EXCEPTIONS.COUNT);
END;I hope you can take an idea from this code.
Regards.
Satyaki De.

Similar Messages

  • SQL Insert Error Error in allocating a connection. Cause: No PasswordCreden

    Friends,
    While testing my connection in the Sun java Application Server , I get the following error .
    "SQL Insert Error Error in allocating a connection. Cause: No PasswordCredential found "
    Can somebody please guide ?
    regards
    Dhiraj

    If you are using Netbeans, then this link might help:
    http://forum.java.sun.com/thread.jspa?forumID=136&threadID=598423
    Otherwise, have you try this ?
    Verify your sun-ejb-jar.xml does not use default-resource-princinpal element:
    <res-ref-name>jdbc/pdisasdb</res-ref-name>
    <jndi-name>jdbc/pdisasdb</jndi-name>
    <default-resource-principal>
    <name>myname</name>
    <password>geheim</password>
    </default-resource-principal>
    </resource-ref>

  • SQL 2005 Insert Error

    Hi Folks-
    It has been a while and I hope this finds you all doing well. 
    I am working oin a customer application and we are experiencing intermitment MS SQL 2005 insert errors.  We have isolated the cause as the use of the special character, the apostrophe (i.e. " " ") in a material/item description.  The underlying MES application can accept the apostrophe along with the SAP MM back-end, but not MII,  The MII version is 12.0.6 Build 14.  The application also uses the Java Plug-in version 1.6.0_07, which is also the Java Runtime version.  I am not sure of the SQL jdbc being used but was hoping that perhaps there was a version that could "handle" this special character issue or if there was a non-programmatic way to address this.  At this point we are anxious about changing Master Data.
    Any insights or suggestions would be appreciated.  Thanks in advance and I look forward to your responses.
    Kevin Fitzgerald
    Invensys Operation Management

    Hi Kedar-
    This is great information and I thank you for your insights.  I do have what I hope are 2 brief follow-on questions:
    1. Does the single quote/apostrophe represent a general escape character that can be used in all cases?  Are there others (i.e. \n, etc.)
    2. Your special characters cited above do not include the asterik, *.  My customer has also decided to use this special character in a new product description (go figure!!).  Can this be "escaped out" via the same means?
    I have been able to successfully use the java function stringreplace to alter the text as you suggest- even for a local and I hope transaction variable.  Any additional comments per my questions above would certainly advance the cause.
    Thanks again and I look forward to your comments.  Take care and be safe.
    Kevin

  • SQL Insert Error

    I am trying to take data from a form and insert it into the mySQL db.
    this is my update stuff:
    s = "INSERT INTO users ";
    s += " "(" id"," name"," email"," age"," gender"," zipcode"," username"," password")"";
    s += " VALUES "("'"+name+"'"," '"+email+"'"," '"+age+"'"," '"+gender+"'"," '"+zipcode+"'"," '"+username+"'"," '"+password+"'")"";
    PreparedStatement stmt = conn.prepareStatement();
    stmt.executeUpdate(s);
    out.write("Updating");
    And then I get this error:
    Ex-Message :Syntax error or access violation, message from server: "You have an error in your SQL syntax near '' at line 1" Ex-Code :1064 Ex-SQLState:42000 Ex-Next :null
    Any ideas?

    Your prepared statement should look something like this:
    s = "INSERT INTO users ";
    s += " (name, email, age, gender, zipcode, username, password)";
    s += " VALUES (?,?,?,?,?,?,?)";
    stmt.setString( 1, "value for name" );
    stmt.setString( 2, "value for email" );
    stmt.setInt( 3, 44);
    // some info on how to set the type of a parameter value:
    // http://developer.java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html#JDBC208
    ...http://developer.java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html#JDBC207
    Try to fill out the following value for name:
    "(=enter)
    UNION select 1 as 'one' --"
    I am not sure if prepared statements take care of sql insertion
    http://www.sensepost.com/misc/SQLinsertion.htm
    If it doesn't I would replace the ' with '' (1 single quote with 2 single quotes)

  • Error in native SQL while inserting data into CORP table

    HI all,
    I am getting an exception while inserting records using native SQL into CORP table.
    PFB the code.
    LOOP AT gi_hrp1001 INTO wa_hrp1001.
      TRY.
            EXEC SQL.
              INSERT INTO misuser.Table_4
              VALUES (wa_hrp1001-otype , wa_hrp1001-objid ).
            ENDEXEC.
          CATCH cx_sy_native_sql_error.
            MESSAGE 'Connect - Error ' TYPE 'E'.
        ENDTRY.
      ENDLOOP.
    Please help.
    Thanks & Regards
    Nitesh

    I see two issue with your Insert. 1) you need to specify the field names in the table, for example otype and objid. 2) You need to indicate in the VALUES that you're using host variables by using the prefix :.
    I think the correct syntax is:
            EXEC SQL.
              INSERT INTO misuser.Table_4
             (otype, objid)
              VALUES (:wa_hrp1001-otype, :wa_hrp1001-objid)
            ENDEXEC.
    Good luck.

  • Error in insert statment in pl/sql

    Hi all,
    How i Execute Insert statment in Pl/Sql
    SQL> DECLARE
    2 tablename varchar2(30);
    3 Begin
    4 begin
    5 select table_name into tablename from user_tables
    6 where table_name=upper('t_calling');
    7 EXCEPTION
    8 WHEN no_data_found then
    9 execute immediate 'create table t_calling(F_CODE number,
    10 F_CALLING varchar2(50))';
    11 INSERT INTO T_Calling VALUES (1, 'asd');
    12 end;
    13 -- --------------------------
    14 Commit;
    15 End;
    16 /
    INSERT INTO T_Calling VALUES (1, 'asd');
    ORA-06550:
    PLS-00201: identifier 'T_CALLING' must be declared
    ORA-06550:
    PL/SQL: SQL Statement ignored
    Thanks
    alaa

    You are creating this table with an execute immediate statement. Which suggests that it doesn't exist yet. Therefore your insert statement is referencing a non-existent table so naturally it won't compile.
    If you really want to do this you should put the insert into an execute immediate statement as well. However, I recommend that you don't do this - it is very bad practice to put this sort of processing in the exception handler. Why? Well, what happens if the table T_CALLING already exists? The exception's got no where to go, so your program fails with an Unhandled Exception error.
    HTH, APC

  • Error in appdstln.sql during upgrade to 12.1.1

    Hi All,
    I am upgrading my 11.5.9 ebs to 12.1.1 I have gone through all steps outlined in chapter 3 of Oracle® E-Business Suite
    Upgrade Guide Release 11i to 12.1.3 Part No. E16342-03. I am now in point number 10 under " Perform the Upgrade" i.e :
    Run the American English upgrade patch driver which is (u6678700.drv)
    After going through nearly 130,000 jobs I got the following error in appdstln.sql
    ORA-01400: cannot insert NULL into("AP"."AP_PAYMENT_HIST_DISTS"."INVOICE_DISTRIBUTION_ID")
    Please help me get through this error asap as we are very low on time.

    Please log a SR as no similar issues are reported in MOS website.
    Thanks,
    Hussein

  • 4.7 Enterprise install error in catproc.sql phase(RedHat5- Oracle 10.2.0.4)

    Hi,
    I am installing SAP 4.7 Enterprise on Red Hat 5.3 and Oracle 10.2.0.4. When I install 4.7 Enterpirse I have an error in catproc.sql phase like below: -
    ERROR 2009-06-02 18:42:34
    CJS-00084  SQL statement or script failed.<br>DIAGNOSIS: Error message: ORA-955 for defaultdestSQL> Rem     bnainani   11/29/00  - specify compatible=8.0 for create_queue_tableSQL> Rem     liwong     10/20/00  - add def$_destination.flagSQL> Rem     bnainani   11/15/00  - specify compatible=8.0 for queue tableSQL> Rem     narora     09/13/00  - add comment on new def$_destination columnsSQL> Rem     liwong     09/01/00  - add master w/o quiesce: fixesSQL> Rem     liwong     07/12/00  - add total_prop_time_latSQL> Rem     liwong     06/29/00  - add total_txn_count, total_prop_timeSQL> Rem     liwong     05/17/00  - add_master_db w/o quiesceSQL> Rem     jstamos    05/17/00  - add_master_db w/o quiesceSQL> Rem     elu        01/24/00  - add column apply_init to def$_destinationSQL> Rem     alakshmi   12/02/99  - Bug 979398: Before-row insert trigger onSQL> Rem                            def$_propagatorSQL> Rem     wesmith    10/31/98 -  change shape of table def$_pushed_transactionsSQL> Rem     jnath      02/23/98 -  bug 601972: split anonymous pl/sql blocksSQL> Rem     wesmith    01/21/98 -  create def$_pushed_transactions table forSQL> Rem                            server-side RepAPISQL> Rem     nbhatt     07/27/97 -  change create_queuetable -> create_queue_tableSQL> Rem     nbhatt     04/21/97 -  change 'TRACKING' in CREATE_QUEUE to 'DEPENDENCYSQL> Rem     nbhatt     04/21/97 -  change syntax of create_queueSQL> Rem     liwong     04/16/97 -  Alter view system.AQ$DEF$_AQ{CALL,ERROR}SQL> Rem     liwong     04/11/97 -  Fixing defaultdest_primary typoSQL> Rem     jstamos    04/10/97 -  remove unneeded indexesSQL> Rem     nbhatt     04/08/97 -  change create_qtable to create_queuetableSQL> Rem     jstamos    04/04/97 -  tighter AQ integrationSQL> Rem     liwong     04/02/97 -  Add schema_name, package_name in def$_calldestSQL> Rem     ato        03/31/97 -  create_qtable interface changeSQL> Rem     liwong     03/25/97 -  remove batch_no from def$_tranorderSQL> Rem     liwong     02/24/97 -  pctversion --> 0 for def$_aqcall, def$_aqerrorSQL> Rem     liwong     02/22/97 -  Remove dropping view aq$def$_aqcallSQL> Rem     ademers    02/07/97 -  Remove constraint def$_calldest_callSQL> Rem     liwong     01/11/97 -  drop and create aq$def$_aqcall (temporary)SQL> Rem     liwong     01/10/97 -  Alter view aq$def$_aqcallSQL> Rem     liwong     01/07/97 -  Alter default value for batch_noSQL> Rem     jstamos    12/23/96 -  change temp$nclob colSQL> Rem     jstamos    11/21/96 -  nchar supportSQL> Rem     sjain      11/11/96 -  Remove dummy buffer # commentSQL> Rem     asgoel     11/05/96 -  Disable misc_tracking in def$_aqerrorSQL> Rem     sjain      11/06/96 -  deferror changesSQL> Rem     vkrishna   10/28/96 -  change STORED IN to STORE AS for lobSQL> Rem     sjain      10/02/96 -  Aq conversionSQL> Rem     sbalaram   09/24/96 -  ARPC performance - add foreign key indexSQL> Rem     jstamos    09/06/96 -  rename temp$lob and temporarily change nclobSQL> Rem     sjain      09/03/96 -  AQ conversonSQL> Rem     ademers    08/02/96 -  queue_batch default in def_destinationSQL> Rem     ademers    07/29/96 -  queue_batch default in def_callSQL> Rem     ademers    07/29/96 -  queue_batch defaultSQL> Rem     jstamos    07/24/96 -  add system.temp$lobSQL> Rem     sbalaram   07/22/96 -  create def$_aqcall and def$_aqerror tablesSQL> Rem     jstamos    06/12/96 -  LOB support for deferred RPCsSQL> Rem     ldoo       06/28/96 -  Comment out queue_table from def_tranorderSQL> Rem     ademers    05/30/96 -  create def_originSQL> Rem     ademers    05/28/96 -  fix def_destination col namesSQL> Rem     ldoo       05/09/96 -  New security modelSQL> Rem     sjain      05/01/96 -  add seq col to def_destinationSQL> Rem     ademers    04/29/96 -  add batch_no, dep_scn to def_callSQL> Rem     jstamos    12/04/95 -  324303: use index to avoid sorting the queueSQL> Rem     jstamos    08/17/95 -  code review changesSQL> Rem     jstamos    08/16/95 -  add comments to tablesSQL> Rem     wmaimone   01/04/96 -  7.3 mergeSQL> Rem     hasun      01/31/95 -  Modify tables.<br>SOLUTION: See ora_sql_results.log and the Oracle documentation for details.
    Also  some error lines in ora_sql_results.log file like below:
    Connected to an idle instance.
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux-x86_64 Error: 2: No such file or directory
    Disconnected
    DOC>     The following statement will cause an "ORA-01722: invalid number"
    DOC>     error and terminate the SQLPLUS session if the user is not SYS.
    DOC>     Disconnect and reconnect with AS SYSDBA.
    ERROR at line 1:
    ORA-01432: public synonym to be dropped does not exist
    ERROR at line 1:
    ORA-00942: table or view does not exist
    DOC>     The following PL/SQL block will cause an ORA-20000 error and
    DOC>     terminate the current SQLPLUS session if the user is not SYS.
    DOC>     Disconnect and reconnect with AS SYSDBA.
    ERROR at line 1:
    ORA-01921: role name 'EXP_FULL_DATABASE' conflicts with another user or role
    name
    ERROR at line 1:
    ORA-01434: private synonym to be dropped does not exist
    ERROR at line 1:
    ORA-04043: object DIANA does not exist
    ERROR at line 1:
    ORA-04043: object DIUTIL does not exist
    ERROR at line 1:
    ORA-04043: object DIUTIL does not exist
    ERROR at line 1:
    ORA-04043: object SUBPTXT2 does not exist
    ERROR at line 1:
    ORA-04043: object CREATE_TABLE_COST_COLUMNS does not exist
    ERROR at line 1:
    ORA-01434: private synonym to be dropped does not exist
    And ora_sql.log  file is:
    connect  /  as sysdba ;
    SHUTDOWN ABORT;
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    SHUTDOWN IMMEDIATE;
    exit;
    Executed with error.
    connect  /  as sysdba ;
    STARTUP NOMOUNT;
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    CREATE DATABASE MDP CONTROLFILE REUSE  MAXLOGFILES 255 MAXLOGMEMBERS 3 MAXLOGHISTORY 1000 MAXDATAFILES 254 MAXINSTANCES 50 NOARCHIVELOG CHARACTER SET UTF8 NATIONAL CHARACTER SET UTF8 DATAFILE '/oracle/MDP/sapdata1/system_1/system.data1' SIZE 350M REUSE AUTOEXTEND ON NEXT 20M MAXSIZE 10000M EXTENT MANAGEMENT LOCAL DEFAULT TEMPORARY TABLESPACE PSAPTEMP TEMPFILE '/oracle/MDP/sapdata1/temp_1/temp.data1' SIZE 1750M REUSE AUTOEXTEND ON NEXT 20M MAXSIZE 10000M UNDO TABLESPACE PSAPUNDO DATAFILE '/oracle/MDP/sapdata1/undo_1/undo.data1' SIZE 700M REUSE AUTOEXTEND ON NEXT 20M MAXSIZE 10000M SYSAUX DATAFILE '/oracle/MDP/sapdata1/sysaux_1/sysaux.data1' SIZE 1000M REUSE AUTOEXTEND ON NEXT 20M MAXSIZE 10000M
    LOGFILE GROUP 1 ('/oracle/MDP/origlogA/log_g11m1.dbf',
    '/oracle/MDP/mirrlogA/log_g11m2.dbf') SIZE 50M  REUSE ,
    GROUP 2 ('/oracle/MDP/origlogB/log_g12m1.dbf',
    '/oracle/MDP/mirrlogB/log_g12m2.dbf') SIZE 50M  REUSE ,
    GROUP 3 ('/oracle/MDP/origlogA/log_g13m1.dbf',
    '/oracle/MDP/mirrlogA/log_g13m2.dbf') SIZE 50M  REUSE ,
    GROUP 4 ('/oracle/MDP/origlogB/log_g14m1.dbf',
    '/oracle/MDP/mirrlogB/log_g14m2.dbf') SIZE 50M  REUSE
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    set newpage 0
    set space 0
    set pagesize 0
    set linesize 32767
    set markup HTML off
    set heading off
    set verify off
    set feedback off
    set trimspool on
    set sqlprompt SQL>
    set termout on
    set verify off
    set echo off
    spool ora_query3_tmp0_1.res
    SELECT STATUS FROM V$INSTANCE;
    spool off
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    @@/oracle/MDP/102_64/rdbms/admin/catalog.sql
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    set newpage 0
    set space 0
    set pagesize 0
    set linesize 32767
    set markup HTML off
    set heading off
    set verify off
    set feedback off
    set trimspool on
    set sqlprompt SQL>
    set termout on
    set verify off
    set echo off
    spool ora_query3_tmp0_1.res
    SELECT STATUS FROM V$INSTANCE;
    spool off
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    @@/oracle/MDP/102_64/rdbms/admin/catblock.sql
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    set newpage 0
    set space 0
    set pagesize 0
    set linesize 32767
    set markup HTML off
    set heading off
    set verify off
    set feedback off
    set trimspool on
    set sqlprompt SQL>
    set termout on
    set verify off
    set echo off
    spool ora_query3_tmp0_1.res
    SELECT STATUS FROM V$INSTANCE;
    spool off
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    @@/oracle/MDP/102_64/rdbms/admin/catproc.sql
    exit;
    Executed with error.
    connect  /  as sysdba ;
    set newpage 0
    set space 0
    set pagesize 0
    set linesize 32767
    set markup HTML off
    set heading off
    set verify off
    set feedback off
    set trimspool on
    set sqlprompt SQL>
    set termout on
    set verify off
    set echo off
    spool ora_query3_tmp0_1.res
    SELECT STATUS FROM V$INSTANCE;
    spool off
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    @@/oracle/MDP/102_64/rdbms/admin/catproc.sql
    exit;
    Executed with error.
    connect  /  as sysdba ;
    set newpage 0
    set space 0
    set pagesize 0
    set linesize 32767
    set markup HTML off
    set heading off
    set verify off
    set feedback off
    set trimspool on
    set sqlprompt SQL>
    set termout on
    set verify off
    set echo off
    spool ora_query3_tmp0_1.res
    SELECT STATUS FROM V$INSTANCE;
    spool off
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    @@/oracle/MDP/102_64/rdbms/admin/catproc.sql
    exit;
    Executed with error.
    connect  /  as sysdba ;
    set newpage 0
    set space 0
    set pagesize 0
    set linesize 32767
    set markup HTML off
    set heading off
    set verify off
    set feedback off
    set trimspool on
    set sqlprompt SQL>
    set termout on
    set verify off
    set echo off
    spool ora_query3_tmp0_1.res
    SELECT STATUS FROM V$INSTANCE;
    spool off
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    @@/oracle/MDP/102_64/rdbms/admin/catproc.sql
    exit;
    Executed with error.
    connect  /  as sysdba ;
    set newpage 0
    set space 0
    set pagesize 0
    set linesize 32767
    set markup HTML off
    set heading off
    set verify off
    set feedback off
    set trimspool on
    set sqlprompt SQL>
    set termout on
    set verify off
    set echo off
    spool ora_query3_tmp0_1.res
    SELECT STATUS FROM V$INSTANCE;
    spool off
    exit;
    Executed successfully.
    connect  /  as sysdba ;
    @@/oracle/MDP/102_64/rdbms/admin/catproc.sql
    exit;
    Executed with error.
    The errors are like these. How can I correct these errors and continue to installation? Is the oracle version 10.2.0.4  not correct version to install 4.7 enterprise on Red Hat Linux 5.3?
    Best regards,

    Hi Markus,
    I found 5 ERROR. There are different lines.
    First one:
          <fld name="STATUS">
            <strval><![CDATA[ERROR]]>
    Second one:
    CASE (= 'AUTOALLOCATE') RETURN (' AUTOALLOCATE '),
                    CASE (DEFAULT) RETURN (' ERROR ' + (tTablespaces.extMgmtAllocMode 
    Third one:
    CASE (= 'DICTIONARY') RETURN (' DICTIONARY '),
                  CASE (DEFAULT) RETURN (' ERROR ' + (tTablespaces.extMgmtMode 
    Fourth one:
    CASE (= 'AUTOALLOCATE') RETURN (' AUTOALLOCATE '),
                    CASE (DEFAULT) RETURN (' ERROR ' + (tTablespaces.extMgmtAllocMode 
    Fifth one:
    CASE (= 'DICTIONARY') RETURN (' DICTIONARY '),
                  CASE (DEFAULT) RETURN (' ERROR ' + (tTablespaces.extMgmtMode 
    Which one will I change to OK? Must all off them change to OK?
    Also is this problem about only these oracle error in your oppinion? For example in first line of ora_sql_results.log I have an error like below:
    CJS-00084 SQL statement or script failed
    Connected to an idle instance.
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    But ORACLE_HOME and ORACLE_SID environment variable are ok. Also I can connect and start and stop database manually. There is no problem about it.
    I installed anly Oracle patch 10.2.0.4. I didn't install any oracle interim patch. Should I have install oracle interim patch for Oracle 10.2.0.4?
    Best regards,

  • Concurrent manager encountered an error while running sql*plus for your concurrent request create internal order

    Hi
    We have a big problem, We can't create internal orders, when I run the CREATE INTERNAL ORDER, it finish with ERROR:
    Concurrent Manager encountered an error while running SQL*Plus for your concurrent request 134980682.
    Review your concurrent request log and/or report output file for more detailed information.
    this is the log:
    +---------------------------------------------------------------------------+
    Purchasing: Version : 12.0.0
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    POCISO module: Create Internal Orders
    +---------------------------------------------------------------------------+
    Current system time is 26-JUL-2013 09:21:09
    +---------------------------------------------------------------------------+
    +-----------------------------
    | Starting concurrent program execution...
    +-----------------------------
    +---------------------------------------------------------------------------+
    Start of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    Begin create internal sales order
    Updating Req Headers
    14 Reqs selected for processing
    Top of Fetch Loop
    Source Operating Unit: 82
    Selecting Currency Code
    Currency Code : MXP
    Selecting Order Type
    Order Type ID:1001
    Selecting Price List from Order Type
    Deliver To Location Id: 196
    Inserting Header : 3908784
    Getting the customer id
    Getting the customer id: 15334
    Unhandled Exception : ORA-01403: no data found
    +---------------------------------------------------------------------------+
    End of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    Concurrent Manager encountered an error while running SQL*Plus for your concurrent request 134980682.
    Review your concurrent request log and/or report output file for more detailed information.
    +---------------------------------------------------------------------------+
    Executing request completion options...
    Output file size:
    78
    Output is not being printed because:
    The print option has been disabled for this report.
    Finished executing request completion options.
    +---------------------------------------------------------------------------+
    Concurrent request completed
    Current system time is 26-JUL-2013 09:21:14
    +---------------------------------------------------------------------------+
    Some suggestion for resolve it??
    Thanks & Regards.

    In the document 294932.1 Section 4 there are no pre-installation patches or update for OS RedHat LinuxAS4.
    When I type echo $LD_ASSUME_KERNEL it doesn't display any value so do I need to set the LD_Assume_Kernal value manually.
    If yes, please let me know the path and command to set the kernel value.
    Thanks
    Amith

  • Getting Error when running sql from concurrent program in R12

    Hi All,
    I created concurrent program and attached EXECUTABLE which executable method as SQL plus .
    Using this program I am running one SQL file in R12 when I am running I am getting below error .
    Same king of program I have define in 11i and running it is running can anyone please help me if I need to do any set ups or security thing to resave this problem.
    ERROR:
    ORA-01017: invalid username/password; logon denied
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
    where <logon> ::= <username>[<password>][@<connect_identifier>] | /
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
    where <logon> ::= <username>[<password>][@<connect_identifier>] | /
    SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
    Concurrent Manager encountered an error while running SQL*Plus for your concurrent request 3162719.
    Review your concurrent request log and/or report output file for more detailed information.
    Executing request completion options...
    Finished executing request completion options.
    Regrds,
    Sridhar.

    user12000862 wrote:
    Hi all,
    Thanks a lot giving replay below simple code I have put in my SQL file for testing Eventhough it is giving error .
    Table which i am using in Apps schema only.
    declare
    BEGIN
    insert into BRCD_HZ_DNB_XTBL_TEST values (666,'Y','547','Y','12254','TESTING','N','Y');
    commit;
    END;
    /Try this instead
    WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
    WHENEVER OSERROR EXIT FAILURE ROLLBACK;
    insert into BRCD_HZ_DNB_XTBL_TEST values (666,'Y','547','Y','12254','TESTING','N','Y');
    commit;
    exit;HTH
    Srini

  • I am getting Error! java.sql.SQLException:General error

    hi every body,
    I struck with this error , can any one suggest in solving this.
    I had a table in oracledatabase ,i have successfully created a table and inserted clob column with an attachment like xxx.txt.
    table format----> id and text columns
    Now my question is to retrieve that data and store it in local disk i am getting this error
    import java.io.*;
    import java.sql.*;
    //import java.sql.SQLException;
    public class Cread {
    public static void main(String[] args) throws ClassNotFoundException,IOException,SQLException {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection cn=DriverManager.getConnection("jdbc:odbc:sivadsn","scott","tiger");
    Statement s = cn.createStatement();
    ResultSet rs=s.executeQuery("Select text from ram where id=10");
    if(rs.next()){
    FileOutputStream file=new FileOutputStream("c:/store.txt");
    InputStream fin=rs.getBinaryStream(1);
    int c;
    while((c=fin.read())!=-1){
    file.write(c);
    fin.close();
    s.close();
    rs.close();
    catch(IOException e){
    e.printStackTrace();
    System.out.println("Err:"+e);
    I am getting the error as
    java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)Error! java.sql.SQLException: General error
    at attach.Clobread.main(Clobread.java:30)

    That usually means something is wrong with the syntax of your sql.
    As a guess 'text' is probably a keyword and shouldn't be used as a field name. It is possible that the same is true for 'id'

  • Multiple SQLs INSERT in a single SQL with O.Lite on PDA

    Hi,
    We are using(and new to) Oracle on PDA, dvlping in JAVA. We need to increase performance and reliability to make multiple INSERT in a single SQL statement, dynamically created :
    We've got a syntax error when executing this :
    INSERT INTO t1 (row1,row2) VALUES ('x','y');
    INSERT INTO t1 (row1,row2) VALUES ('a','v');
    INSERT INTO t1 (row1,row2) VALUES ('e','r');
    etc... in a single execSql
    Any suggests would be helpfull !
    JMarc
    [email protected]

    Hi Praveen
    If your use case is like having large no. of data rows and inserting those into DB. I believe best appropriate way would be form a xml and then pass it to DB. While in DB, you can create SP and perform your logical steps(if any) thereafter inserting data into table.
    The above link shared by Muzammil talks on the same subject.
    While once within SP(DB layer), you can fetch entire xml using below example:
    DECLARE @data XML;
    -- Element-centered XML
    SET @data = '<data>
        <customer>
          <id>1</id>
          <name>Name 1 </name>
        </customer>
        <customer>
          <id>2</id>
          <name>Name 2</name>
        </customer>
         <customer>
          <id>3</id>
          <name>Name 3</name>
        </customer>  
        </data>';
    SELECT T.customer.value('(id)[1]', 'INT') AS customer_id,
           T.customer.value('(name)[1]', 'VARCHAR(20)') AS customer_name
    FROM @data.nodes('data/customer') AS T(customer);
    The above run will give you output from xml in single shot.
    You can also find maximum no. of rows as below.
    declare @max int
    select @max = @data.value('fn:count(/data/customer/id)','int')
    select @max  
    I believe above should help you around with your insertion...

  • Error in compiling SQL Expression

    In the [Error in SQL Expression; thread, Kurt Reinhardt wrote "Please note, a SQL Expression can only return a single, distinct value per each record in the main recordset.", I tried this where my main Record Selection's SQL query is:
    {GLF_LDG_ACC_TRANS.ldg_name} = {@&CH_LDG_GL_ACT_CURR} and
    {GLF_LDG_ACC_TRANS.period} = {@&CH_PERIOD_GL_CURR} and
    {GLF_LDG_ACC_TRANS.ACCNBRI}  "99991103" and
    {GLF_LDG_ACC_TRANS.DOC_REF1}  "{%SundryCreditors}" and
    {GLF_LDG_ACC_TRANS.DOC_TYPE} = "$APINVCE"
    My SQL Expression %SundryCreditors is:
    select doc_ref1
    from glf_ldg_acc_trans
    where ldg_name = 'APLED09'
      and period = "GLF_LDG_ACC_TRANS"."PERIOD"
      and doc_ref1 = "GLF_LDG_ACC_TRANS"."DOC_REF1"
      and accnbri like 'SUNDRY%'
    which essentially queries the same table as the main recordset using the same key fields, and returns one row only. However, when I click on the Check button in the Formula Workshop window, I get the error message "Error in compiling SQL Expression : Database Connection Error: '42000:MicrosoftODBC SQL Server DriverSQL ServerIncorrect syntax near the keyword 'select'. Database Vendor Code: 156 '".
    Do you know what is my issue?

    If you know what you're doing, you can add a full select statement into a SQL Expression... And Kurt is correct when he says that it may only return a single row of info. Don is also correct when he says that this not what SQL commands are designed for.
    Here's what's happening...
    When you link your tables in the Database Expert and drop fields onto the design surface (and optionally, add criteria to the Select Expert), CR builds out a SQL statement that can is to be sent out to the db server so that the data can be returned. You can view this SQL by going to Database > Show SQL Query...
    When you add a SQL Expression, CR inserts it into the SQL Query as another data column. This is typically done to take advantage of functions that are available in the data base but not in CR.
    A few crafty individuals, like Kurt, have figured out that you can in fact inset a full SELECT query into a SQL Expression and it will be inserted into the CR generated querie's SELECT list as a sub-query.
    Bear in mind 2 things... #1) You have to be familiar with SQL syntax, namely you have to know the proper syntax for using sub-queries in a SELECT list in your data base. #2) CR doesn't officially support is behavior and they won't offer you any help if the current functionality is removed in later versions.
    HTH,
    Jason

  • Error Text = PL/SQL: ORA-00926

    Can some one tell me what the problem is with this, fairly urgent
    ERROR:Line # = 120 Column # = 28 Error Text = PL/SQL: ORA-00926: missing VALUES keyword
    Line # = 120 Column # = 2 Error Text = PL/SQL: SQL [b]Statement ignored
    Oracle Migration Workbench
    CREATE OR REPLACE FUNCTION "SA"."SPCXDB_DELIVERPRJ" (
    CurrUser_ID IN NUMBER DEFAULT NULL,
    Object_ID IN NUMBER DEFAULT NULL,
    Path_ID IN NUMBER DEFAULT NULL,
    IsLastPhase IN NUMBER DEFAULT NULL,
    NewPhase_ID IN NUMBER DEFAULT NULL,
    User_ID IN NUMBER DEFAULT NULL,
    Comment_ IN VARCHAR2 DEFAULT NULL,RC1_CALL IN OUT Omwb_emulation.globalPkg.RCT1 )
    RETURN INTEGER
    AS
    CurrUser_ID_ NUMBER(10,0) := CurrUser_ID;
    Object_ID_ NUMBER(10,0) := Object_ID;
    Path_ID_ NUMBER(10,0) := Path_ID;
    IsLastPhase_ NUMBER(3,0) := IsLastPhase;
    NewPhase_ID_ NUMBER(10,0) := NewPhase_ID;
    User_ID_ NUMBER(10,0) := User_ID;
    Comment__ VARCHAR2(255) := Comment_;
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_crowcnt INTEGER := 0;
    StoO_fetchstatus INTEGER := 0;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    tempVar1 NUMBER :=3;
    tempVar2 NUMBER :=1;
    id NUMBER(10,0);
    CURSOR ptr IS
    SELECT Object_ID
    FROM TT_DVROBJECTS;
    dummy_var1 INTEGER;
    /****** Object: Stored Procedure dbo.spCXDB_deliverprj Script Date: 2003-11-12 14:21:41 ******/
    -- currently logged user id
    BEGIN
    NULL;
    /*[SPCONV-ERR(12)]:(set XACT_ABORT) Manual conversion required*/
    1) update project
    IF SPCXDB_DELIVERPRJ.IsLastPhase_ = 0 THEN
    BEGIN
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    UPDATE sa.CXDBObjects
    SET DvrPath_ID = SPCXDB_DELIVERPRJ.Path_ID_,
    DvrPhase_ID = SPCXDB_DELIVERPRJ.NewPhase_ID_,
    DvrUser_ID = SPCXDB_DELIVERPRJ.User_ID_
    WHERE Object_ID = SPCXDB_DELIVERPRJ.Object_ID_;
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    -- Status = 4
    END;
    ELSE
    BEGIN
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    UPDATE sa.CXDBObjects
    SET DvrPath_ID = 0,
    DvrPhase_ID = 0,
    DvrUser_ID = 0
    WHERE Object_ID = SPCXDB_DELIVERPRJ.Object_ID_;
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    -- Status = 0
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    UPDATE sa.CXDBDeliverPaths
    SET RefCount = RefCount - 1
    WHERE Path_ID = SPCXDB_DELIVERPRJ.Path_ID_;
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    2) get all subobjects , subprojects and documents
    END;
    END IF;
    /* Emulating @@TRANCOUNT functionality in Oracle model */
    omwb_emulation.globalPkg.trancount:=omwb_emulation.globalPkg.trancount+1;
    /*[SPCONV-ERR(55)]:CREATE TABLE TT_DVROBJECTS_2-- TT_DVROBJECTS Will be used -- statement passed to ddl file*/
    DELETE FROM TT_DVROBJECTS;
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    INSERT INTO TT_DVROBJECTS ; /*ERROR:Line # = 120 Column # = 28 Error Text = PL/SQL: ORA-00926: missing VALUES keyword
    Line # = 120 Column # = 2 Error Text = PL/SQL: SQL Statement ignored
    SQL SERVER 2000
    BEGIN TRAN
    CREATE TABLE #DvrObjects ( Object_ID int NOT NULL )
    NSERT
    #DvrObjects
    EXEC
    spCXDB_expandtree @Object_ID,3,1 */
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    BEGIN
    /* demoDMS*/sa.spCXDB_expandtree(SPCXDB_DELIVERPRJ.Object_ID_,
    tempVar1,
    tempVar2,
    RC1 => RC1_CALL);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    3) put documents and projects onto deliver path
    NULL;/*DECLARE CURSOR ptr */
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    StoO_crowcnt := 0;
    OPEN ptr;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    StoO_crowcnt := 0;
    FETCH ptr INTO
    SPCXDB_DELIVERPRJ.id;
    EXCEPTION
    WHEN OTHERS THEN
    StoO_rowcnt := 0;
    StoO_selcnt := 0;
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    IF ptr%NOTFOUND THEN
    StoO_sqlstatus := 2;
    StoO_fetchstatus := -1;
    ELSE
    StoO_sqlstatus := 0;
    StoO_fetchstatus := 0;
    END IF;
    <<i_loop1>>
    WHILE ( StoO_fetchstatus = 0) LOOP
    BEGIN
    -- IF (SELECT Status FROM CXDBObjects WHERE Object_ID = @id) = 4 AND
    BEGIN
    StoO_selcnt := 0;
    StoO_error := 0;
    StoO_rowcnt := 0;
    SELECT 1 INTO StoO_selcnt
    FROM DUAL
    WHERE 0 <> (
    SELECT DvrPhase_ID
    FROM CXDBObjects
    WHERE Object_ID = SPCXDB_DELIVERPRJ.id ) AND SPCXDB_DELIVERPRJ.Path_ID_
    = (
    SELECT DvrPath_ID
    FROM CXDBObjects
    WHERE Object_ID = SPCXDB_DELIVERPRJ.id );
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    StoO_rowcnt := 0;
    StoO_selcnt := 0;
    WHEN OTHERS THEN
    StoO_rowcnt := 0;
    StoO_selcnt := 0;
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    IF StoO_selcnt != 0 THEN
    BEGIN
    BEGIN
    BEGIN
    StoO_selcnt := 0;
    StoO_error := 0;
    StoO_rowcnt := 0;
    SELECT 1 INTO StoO_selcnt
    FROM DUAL
    WHERE 0 = (
    SELECT type_
    FROM CXDBObjects
    WHERE Object_ID = SPCXDB_DELIVERPRJ.id );
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    StoO_rowcnt := 0;
    StoO_selcnt := 0;
    WHEN OTHERS THEN
    StoO_rowcnt := 0;
    StoO_selcnt := 0;
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    IF StoO_selcnt != 0 THEN
    BEGIN
    -- update project data
    IF SPCXDB_DELIVERPRJ.IsLastPhase_ = 0 THEN
    BEGIN
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    UPDATE sa.CXDBObjects
    SET DvrPath_ID = SPCXDB_DELIVERPRJ.Path_ID_,
    DvrPhase_ID = SPCXDB_DELIVERPRJ.NewPhase_ID_,
    DvrUser_ID = SPCXDB_DELIVERPRJ.User_ID_
    WHERE Object_ID = SPCXDB_DELIVERPRJ.id;
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    -- Status = 4
    END;
    ELSE
    BEGIN
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    UPDATE sa.CXDBObjects
    SET DvrPath_ID = 0,
    DvrPhase_ID = 0,
    DvrUser_ID = 0
    WHERE Object_ID = SPCXDB_DELIVERPRJ.id;
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    -- Status = 0
    --decrease path reference counter
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    UPDATE sa.CXDBDeliverPaths
    SET RefCount = RefCount - 1
    WHERE Path_ID = SPCXDB_DELIVERPRJ.Path_ID_;
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    END;
    END IF;
    END;
    ELSE
    BEGIN
    BEGIN
    dummy_var1 := /* demoDMS*/sa.spCXDB_deliverdocument(SPCXDB_DELIVERPRJ.CurrUser_ID_,
    SPCXDB_DELIVERPRJ.id,
    SPCXDB_DELIVERPRJ.Path_ID_,
    SPCXDB_DELIVERPRJ.IsLastPhase_,
    SPCXDB_DELIVERPRJ.NewPhase_ID_,
    SPCXDB_DELIVERPRJ.User_ID_,
    SPCXDB_DELIVERPRJ.Comment__);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    END;
    END IF;
    END;
    END;
    END IF;
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    StoO_crowcnt := 0;
    FETCH ptr INTO
    SPCXDB_DELIVERPRJ.id;
    EXCEPTION
    WHEN OTHERS THEN
    StoO_rowcnt := 0;
    StoO_selcnt := 0;
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    IF ptr%NOTFOUND THEN
    StoO_sqlstatus := 2;
    StoO_fetchstatus := -1;
    ELSE
    StoO_sqlstatus := 0;
    StoO_fetchstatus := 0;
    END IF;
    END;
    END LOOP;
    BEGIN
    StoO_error := 0;
    StoO_rowcnt := 0;
    CLOSE ptr;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
    raise_application_error(SQLCODE, SQLERRM,true);
    END;
    NULL;
    /* Emulating @@TRANCOUNT functionality in Oracle model */
    IF omwb_emulation.globalPkg.trancount = 1 THEN
    COMMIT WORK;
    END IF;
    IF omwb_emulation.globalPkg.trancount > 0 THEN
    omwb_emulation.globalPkg.trancount:=omwb_emulation.globalPkg.trancount-1;
    END IF;
    RETURN (0);
    END SPCXDB_DELIVERPRJ;
    Thank's

    Hi Hilary,
    This is the original T-SQL code. Please, help me.
    CREATE PROCEDURE spCXDB_deliverPrj
    @CurrUser_ID     int,          -- currently logged user id
    @Object_ID     int,
    @Path_ID     int,
    @IsLastPhase     tinyint,
    @NewPhase_ID int,
    @User_ID     int,
    @Comment     varchar(255) = NULL
    AS
    SET XACT_ABORT ON
         1) update project
    IF @IsLastPhase = 0
    BEGIN
         UPDATE
              CXDBObjects
         SET
              DvrPath_ID = @Path_ID,
              DvrPhase_ID = @NewPhase_ID,
              DvrUser_ID = @User_ID
    --          Status = 4
         WHERE
              Object_ID = @Object_ID
    END
    ELSE
    BEGIN
         UPDATE
              CXDBObjects
         SET
              DvrPath_ID = 0,
              DvrPhase_ID = 0,
              DvrUser_ID = 0
    --          Status = 0
         WHERE
              Object_ID = @Object_ID
         UPDATE
              CXDBDeliverPaths
         SET
              RefCount = RefCount - 1
         WHERE
              Path_ID = @Path_ID
    END
         2) get all subobjects , subprojects and documents
    BEGIN TRAN
    CREATE TABLE #DvrObjects ( Object_ID int NOT NULL )
    INSERT
         #DvrObjects
    EXEC
         spCXDB_expandtree @Object_ID,3,1
         3) put documents and projects onto deliver path
    DECLARE @id int
    DECLARE ptr CURSOR FOR SELECT Object_ID FROM #dvrobjects
    OPEN ptr
    FETCH NEXT FROM ptr INTO @id
    WHILE(@@FETCH_STATUS = 0)
    BEGIN
    --     IF     (SELECT Status FROM CXDBObjects WHERE Object_ID = @id) = 4 AND
         IF     (SELECT DvrPhase_ID FROM CXDBObjects WHERE Object_ID = @id) <> 0 AND
              (SELECT DvrPath_ID FROM CXDBObjects WHERE Object_ID = @id) = @Path_ID
         BEGIN
              IF (SELECT type FROM CXDBObjects WHERE Object_ID = @id) = 0
              BEGIN
                   -- update project data
                   IF @IsLastPhase = 0
                   BEGIN
                        UPDATE
                             CXDBObjects
                        SET
                             DvrPath_ID = @Path_ID,
                             DvrPhase_ID = @NewPhase_ID,
                             DvrUser_ID = @User_ID
    --                         Status = 4
                        WHERE
                             Object_ID = @id
                   END
                   ELSE
                   BEGIN
                        UPDATE
                             CXDBObjects
                        SET
                             DvrPath_ID = 0,
                             DvrPhase_ID = 0,
                             DvrUser_ID = 0
    --                         Status = 0
                        WHERE
                             Object_ID = @id
                        --decrease path reference counter
                        UPDATE
                             CXDBDeliverPaths
                        SET
                             RefCount = RefCount - 1
                        WHERE
                             Path_ID = @Path_ID
                        END
              END
              ELSE
              BEGIN
                   EXEC spCXDB_deliverdocument @CurrUser_ID, @id,@Path_ID,@IsLastPhase,@NewPhase_ID,@User_ID, @Comment
              END
         END
         FETCH NEXT FROM ptr INTO @id
    END
    CLOSE ptr
    DEALLOCATE ptr
    COMMIT TRAN
    RETURN(0)
    Regards,
    Emilia.

  • Insert to XE from sql server 2005 ...

    Hi,
    is it possible to create a trigger on Sql Server 2005 to insert a row to Oracle XE ?
    I want to create a update/insert trigger on sql server 2005 which will insert the data into a Oracle XE table.
    I have a Linked Servers in Sql Server to Oracle XE and this link works with simple sql statement from sql server like :
    INSERT INTO [NEW_OR]..[Adam_user].[DUMMY] (AA) VALUES('Dummy String Data')
    But the same statement does not work when in trigger. the following error occurs in Sql Server 2005...
    Msg 8501, Level 16, State 3, Procedure deneme, Line 5
    MSDTC on server 'Adam_user' is unavailable.
    Any suggestions?
    Thanks in advance.....
    Adam

    Here is the answer...
    May be useful for someone who needs the same solution ...
    The Distributed Transaction Coordinator service must be start on windows to accomplish the transaction ...
    For this:
    (on windows)
    START > SETTINGS > CONTROL PANEL > ADMINISTRATIVE TOOLS > SERVICES. Find the service called 'Distributed Transaction Coordinator' and RIGHT CLICK (on it and select) > Start.

Maybe you are looking for