Error after insert, delete, insert operations

Hi,
i have another problem with toplink. I have main table and dependent table in jspx page. Dependent table shows collection from main POJO object. Now, when i call create to dependent table, fill the row and call update on main, everything is Ok, the object from dependent table is inserted into database and the main object is updated.
After that i again edit the main object and dependent row marks as deleted (by field "deleted" in database) so the object disappears.
But when i again try to insert a row in dependent table and call update on main object i get an exception
javax.faces.el.EvaluationException: javax.ejb.EJBException: V�jimka [TOPLINK-7197] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.ValidationException
Popis v�jimky: V�jimka p?i ur?ov�n� zm?n. Prim�rn� kl�? nelze nastavit na hodnotu null.; nested exception is: V�jimka [TOPLINK-7197] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.ValidationException
Popis v�jimky: V�jimka p?i ur?ov�n� zm?n. Prim�rn� kl�? nelze nastavit na hodnotu null.
Primary key cannot be set to null. (my translation)
it looks like toplink call update instead of insert on an object ... why is that ?
thanks for help.
I have Jdeveloper version 10.1.3.0.4(SU5)

I am having a similar problem, did you find a solution to this yet?
Thanks for any info.

Similar Messages

  • ORA-01456 : may not perform insert/delete/update operation

    When I use following stored procedure with crystal reports, following error occurs.
    ORA-01456 : may not perform insert/delete/update operation inside a READ ONLY transaction
    Kindly help me on this, please.
    My stored procedure is as under:-
    create or replace
    PROCEDURE PROC_FIFO
    (CV IN OUT TB_DATA.CV_TYPE,FDATE1 DATE, FDATE2 DATE,
    MSHOLD_CODE IN NUMBER,SHARE_ACCNO IN VARCHAR)
    IS
    --DECLARE VARIABLES
    V_QTY NUMBER(10):=0;
    V_RATE NUMBER(10,2):=0;
    V_AMOUNT NUMBER(12,2):=0;
    V_DATE DATE:=NULL;
    --DECLARE CURSORS
    CURSOR P1 IS
    SELECT *
    FROM FIFO
    WHERE SHARE_TYPE IN ('P','B','R')
    ORDER BY VOUCHER_DATE,
    CASE WHEN SHARE_TYPE='P' THEN 1
    ELSE
    CASE WHEN SHARE_TYPE='R' THEN 2
    ELSE
    CASE WHEN SHARE_TYPE='B' THEN 3
    END
    END
    END,
    TRANS_NO;
    RECP P1%ROWTYPE;
    CURSOR S1 IS
    SELECT * FROM FIFO
    WHERE SHARE_TYPE='S'
    AND TRANS_COST IS NULL
    ORDER BY VOUCHER_DATE,TRANS_NO;
    RECS S1%ROWTYPE;
    --BEGIN QUERIES
    BEGIN
    DELETE FROM FIFO;
    --OPENING BALANCES
    INSERT INTO FIFO
    VOUCHER_NO,VOUCHER_TYPE,VOUCHER_DATE,TRANS_QTY,TRANS_AMT,TRANS_RATE,
    SHOLD_CODE,SHARE_TYPE,ACC_NO,SHARE_CODE,TRANS_NO)
    SELECT TO_CHAR(FDATE1,'YYYYMM')||'001' VOUCHER_NO,'OP' VOUCHER_TYPE,
    FDATE1-1 VOUCHER_DATE,
    SUM(
    CASE WHEN
    --((SHARE_TYPE ='S' AND DTAG='Y')
    SHARE_TYPE IN ('P','B','R','S') THEN
    TRANS_QTY
    ELSE
    0
    END
    ) TRANS_QTY,
    SUM(TRANS_AMT),
    NVL(CASE WHEN SUM(TRANS_AMT)<>0
    AND
    SUM
    CASE WHEN SHARE_TYPE IN ('P','B','R','S') THEN
    TRANS_QTY
    ELSE
    0
    END
    )<>0 THEN
    SUM(TRANS_AMT)/
    SUM
    CASE WHEN SHARE_TYPE IN ('P','B','R','S') THEN
    TRANS_QTY
    ELSE
    0
    END
    ) END,0) TRANS_RATE,
    MSHOLD_CODE SHOLD_CODE,'P' SHARE_TYPE,SHARE_ACCNO ACC_NO,
    SHARE_CODE,0 TRANS_NO
    FROM TRANS
    WHERE ACC_NO=SHARE_ACCNO
    AND SHOLD_CODE= MSHOLD_CODE
    AND VOUCHER_DATE<FDATE1
    --AND
    --(SHARE_TYPE='S' AND DTAG='Y')
    --OR SHARE_TYPE IN ('P','R','B'))
    group by TO_CHAR(FDATE1,'YYYYMM')||'001', MSHOLD_CODE,SHARE_ACCNO, SHARE_CODE;
    COMMIT;
    --TRANSACTIONS BETWEEND DATES
    INSERT INTO FIFO
    TRANS_NO,VOUCHER_NO,VOUCHER_TYPE,
    VOUCHER_DATE,TRANS_QTY,
    TRANS_RATE,TRANS_AMT,SHOLD_CODE,SHARE_CODE,ACC_NO,
    DTAG,TRANS_COST,SHARE_TYPE
    SELECT TRANS_NO,VOUCHER_NO,VOUCHER_TYPE,
    VOUCHER_DATE,TRANS_QTY,
    CASE WHEN SHARE_TYPE='S' THEN
    NVL(TRANS_RATE-COMM_PER_SHARE,0)
    ELSE
    NVL(TRANS_RATE+COMM_PER_SHARE,0)
    END
    ,TRANS_AMT,SHOLD_CODE,SHARE_CODE,ACC_NO,
    DTAG,NULL TRANS_COST,SHARE_TYPE
    FROM TRANS
    WHERE ACC_NO=SHARE_ACCNO
    AND SHOLD_CODE= MSHOLD_CODE
    AND VOUCHER_DATE BETWEEN FDATE1 AND FDATE2
    AND
    ((SHARE_TYPE='S' AND DTAG='Y')
    OR SHARE_TYPE IN ('P','R','B'));
    COMMIT;
    --PURCHASE CURSOR
    IF P1%ISOPEN THEN
    CLOSE P1;
    END IF;
    OPEN P1;
    LOOP
    FETCH P1 INTO RECP;
    V_QTY:=RECP.TRANS_QTY;
    V_RATE:=RECP.TRANS_RATE;
    V_DATE:=RECP.VOUCHER_DATE;
    dbms_output.put_line('V_RATE OPENING:'||V_RATE);
    dbms_output.put_line('OP.QTY2:'||V_QTY);
    EXIT WHEN P1%NOTFOUND;
    --SALES CURSOR
    IF S1%ISOPEN THEN
    CLOSE S1;
    END IF;
    OPEN S1;
    LOOP
    FETCH S1 INTO RECS;
    EXIT WHEN S1%NOTFOUND;
    dbms_output.put_line('OP.QTY:'||V_QTY);
    dbms_output.put_line('SOLD:'||RECS.TRANS_QTY);
    dbms_output.put_line('TRANS_NO:'||RECS.TRANS_NO);
    dbms_output.put_line('TRANS_NO:'||RECS.TRANS_NO);
    IF ABS(RECS.TRANS_QTY)<=V_QTY
    AND V_QTY<>0
    AND RECS.TRANS_COST IS NULL THEN
    --IF RECS.TRANS_COST IS NULL THEN
    --dbms_output.put_line('SOLD:'||RECS.TRANS_QTY);
    --dbms_output.put_line('BAL1:'||V_QTY);
    UPDATE FIFO
    SET TRANS_COST=V_RATE,
    PUR_DATE=V_DATE
    WHERE TRANS_NO=RECS.TRANS_NO
    AND TRANS_COST IS NULL;
    COMMIT;
    dbms_output.put_line('UPDATE TRANS_NO:'||RECS.TRANS_NO);
    dbms_output.put_line('OP.QTY:'||V_QTY);
    dbms_output.put_line('SOLD:'||RECS.TRANS_QTY);
    dbms_output.put_line('TRANS_NO:'||RECS.TRANS_NO);
    dbms_output.put_line('BAL2:'||TO_CHAR(RECS.TRANS_QTY+V_QTY));
    END IF;
    IF ABS(RECS.TRANS_QTY)>ABS(V_QTY)
    AND V_QTY<>0 AND RECS.TRANS_COST IS NULL THEN
    UPDATE FIFO
    SET
    TRANS_QTY=-V_QTY,
    TRANS_COST=V_RATE,
    TRANS_AMT=ROUND(V_QTY*V_RATE,2),
    PUR_DATE=V_DATE
    WHERE TRANS_NO=RECS.TRANS_NO;
    --AND TRANS_COST IS NULL;
    COMMIT;
    dbms_output.put_line('UPDATING 100000:'||TO_CHAR(V_QTY));
    dbms_output.put_line('UPDATING 100000 TRANS_NO:'||TO_CHAR(RECS.TRANS_NO));
    INSERT INTO FIFO
    TRANS_NO,VOUCHER_NO,VOUCHER_TYPE,
    VOUCHER_DATE,TRANS_QTY,
    TRANS_RATE,TRANS_AMT,SHOLD_CODE,SHARE_CODE,ACC_NO,
    DTAG,TRANS_COST,SHARE_TYPE,PUR_DATE
    VALUES
    MCL.NEXTVAL,RECS.VOUCHER_NO,RECS.VOUCHER_TYPE,
    RECS.VOUCHER_DATE,RECS.TRANS_QTY+V_QTY,
    RECS.TRANS_RATE,(RECS.TRANS_QTY+V_QTY)*RECS.TRANS_RATE,RECS.SHOLD_CODE,
    RECS.SHARE_CODE,RECS.ACC_NO,
    RECS.DTAG,NULL,'S',V_DATE
    dbms_output.put_line('INSERTED RECS.QTY:'||TO_CHAR(RECS.TRANS_QTY));
    dbms_output.put_line('INSERTED QTY:'||TO_CHAR(RECS.TRANS_QTY+V_QTY));
    dbms_output.put_line('INSERTED V_QTY:'||TO_CHAR(V_QTY));
    dbms_output.put_line('INSERTED RATE:'||TO_CHAR(V_RATE));
    COMMIT;
    V_QTY:=0;
    V_RATE:=0;
    EXIT;
    END IF;
    IF V_QTY>0 THEN
    V_QTY:=V_QTY+RECS.TRANS_QTY;
    ELSE
    V_QTY:=0;
    V_RATE:=0;
    EXIT;
    END IF;
    --dbms_output.put_line('BAL3:'||V_QTY);
    END LOOP;
    V_QTY:=0;
    V_RATE:=0;
    END LOOP;
    CLOSE S1;
    CLOSE P1;
    OPEN CV FOR
    SELECT TRANS_NO,VOUCHER_NO,VOUCHER_TYPE,
    VOUCHER_DATE,TRANS_QTY,
    TRANS_RATE,TRANS_AMT,SHOLD_CODE,B.SHARE_CODE,B.ACC_NO,
    DTAG,TRANS_COST,SHARE_TYPE, B.SHARE_NAME,A.PUR_DATE
    FROM FIFO A, SHARES B
    WHERE A.SHARE_CODE=B.SHARE_CODE
    --AND A.SHARE_TYPE IS NOT NULL
    ORDER BY VOUCHER_DATE,SHARE_TYPE,TRANS_NO;
    END PROC_FIFO;
    Thanks and Regards,
    Luqman

    Copy from TODOEXPERTOS.COM
    Problem Description
    When running a RAM build you get the following error as seen in the RAM build
    log file:
    14:52:50 2> Updating warehouse tables with build information...
    Process Terminated In Error:
    [Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction
    (SIGENG02) ([Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction
    ) Please contact the administrator of your Oracle Express Server application.
    Solution Description
    Here are the following suggestions to try out:
    1. You may want to use oci instead of odbc for your RAM build, provided you
    are running an Oracle database. This is setup through the RAA (relational access
    administrator) maintenance procedure.
    Also make sure your tnsnames.ora file is setup correctly in either net80/admin
    or network/admin directory, to point to the correct instance of Oracle.
    2. Commit or rollback the current transaction, then retry running your
    RAM build. Seems like one or more of your lookup or fact tables have a
    read-only lock on them. This occurs if you modify or add some records to your
    lookup or fact tables but forget to issue a commit or rollback. You need to do
    this through SQL+.
    3. You may need to check what permissions has been given to the relational user.
    The error could be a permissions issue.
    You must give 'connect' permission or roll to the RAM/relational user. You may
    also try giving 'dba' and 'resource' priviliges/roll to this user as a test. Inorder to
    keep it simple, make sure all your lookup, fact and wh_ tables are created on
    a single new tablespace. Create a new user with the above privileges as the
    owner of the tablespace, as well as the owner of the lookup, fact and wh_
    tables, inorder to see if this is a permissions issue.
    In this particular case, the problem was resolved by using oci instead of odbc,
    as explained in suggestion# 1.

  • How do I insert/Delete/Update a row to the DB Table from Business Component Browser

    I am using the wizard and created a project containing Business component which contain some table.
    When I run the project I could see "Oracle Business Component Browser(local)" and when I select some table from "View Object Member" I get a window displaying all the field of that table and I could browse all the info.
    My Problem is when I try to insert a new record/Delete the existing record or update some record it never gets reflected to the DataBase.
    When I try to insert a new row I did save and there was a dialog box displayed saying "Transaction ID is 1". But finally It's not reflected in the Database.
    Can some one guide me how can I do insert/delete/update operation from Oracle Component Business Browser so that the changes reflect to the Original DataBase.
    Thanks in advance
    Jitendra

    Jitendra,
    This may be a problem of caching. If you do an update,insert, or delete, and do not receive an error, then the transaction should indeed be posted.
    I assume you are hitting the Save icon after your changes if you are getting a transaction ID. Are you checking for the updates through another session (i.e. SQL*Plus), or do you then requery the View Object in the tester? Do you exit the tester and come back in and not see the changes?

  • JBO-26048 error after insert delete commit

    Using JDeveloper 10.1.2 running local OC4J against Oracle 9i database
    * JBO-26048: Constraint "APPLREFLTR_PK" violated during post operation:"Insert" using SQL Statement "BEGIN INSERT INTO DCSAT_APPL_REF_LETTER(APPLICANT_ID,LETTER_ID,LETTER_INF,CREATED_BY,CREATED_DATE,UPDATED_BY,UPDATED_DATE) VALUES (:1,:2,:3,:4,:5,:6,:7) RETURNING APPLICANT_ID INTO :8; END;".
    * ORA-00001: unique constraint (APPTRACK.APPLREFLTR_PK) violated ORA-06512: at line 1
    This was working yesterday??? I was so close then spent a day trying to track down what broke. I tried changing the database primary key to deferrable, which just changed the error message to one that said I had too many primary keys.
    Basically the following code inserts a blank row into the view object. It then looks for an existing record, if found row.remove() is called on the found row. I then update the primary key in the current record from data on the form. (The primary key is set as a dbsequence, but there isn't a trigger to set it.) then commit. I was thinking that it was the chronological order bit that is listed in the latest ADF documentation. The thing is, this did work. A case of turning off the computer, removing all class files, rebuilding the tables and running the app - now broken...
    I would appreciate ideas on where to troubleshoot, or help on how to troubleshoot this one.
    Thanks,
    Ken
    I am uploading files into an ORDSYS.ORDDOC datatype following example 3 from Steve Muench's weblog. Here is the code in my DataActionForward:
    <code>
    public class UploadReferenceLettersAction extends DataForwardAction {
    protected void processUpdateModel(DataActionContext actionContext) {
    System.out.println("*** UploadReferenceLettersAction.processUpdateModel() ***");
    super.processUpdateModel(actionContext);
    if (!(handlingEvents(actionContext))) {
    /* Create a blank record in the model and set it as the current row - only the first time in. */
    BindingContext bc = actionContext.getBindingContext();
    DCDataControl dc = bc.findDataControl("ApptrackModuleDataControl");
    ApptrackModule service = (ApptrackModule)dc.getDataProvider();
    service.insertRowRefLetterView();
    protected void findForward(DataActionContext actionContext) throws Exception {
    System.out.println("*** UploadReferenceLettersAction.findForward() ***");
    /* Try to catch errors instead of the default error handler. */
    try {
    List events = actionContext.getEvents();
    if (events != null && events.size() > 0) {
    ListIterator li = events.listIterator();
    while (li.hasNext()) {
    System.out.println("UploadApplicantResumeAction.findForward()- event : " + li.next().toString());
    } catch (Exception e) {
    System.out.println(e.getMessage() );
    // e.printStackTrace(System.out);
    super.findForward(actionContext);
    public void onCommit( DataActionContext ctx ) {
    System.out.println("*** UploadReferenceLettersAction.onCommit() ***");
    /* Get LetterId from the form
    DCBindingContainer bindings = ctx.getBindingContainer();
    DCControlBinding binding;
    binding = bindings.findCtrlBinding("LetterId");
    String letterId = (binding != null) ? binding.toString() : "";
    DBSequence letterID = new DBSequence(letterId);
    /* get applicantId */
    HttpSession session = ctx.getHttpServletRequest().getSession();
    String applicantId = "" + (String)session.getAttribute("applicantid");
    DBSequence applicantID = new DBSequence(applicantId);
    /* Remove and existing record with applicantId and letterId */
    BindingContext bctx = ctx.getBindingContext();
    DCDataControl dc = bctx.findDataControl("ApptrackModuleDataControl");
    ApptrackModule service = (ApptrackModule)dc.getDataProvider();
    // service.deleteRefLetterByApplicantidLetterid(applicantId, letterId); // passing values as Strings
    service.deleteRefLetterByApplicantidLetterid(applicantId); // passing values as Strings
    /* Update the currentRow */
    System.out.println("UploadReferenceLettersAction.onCommit() - applicantId = " + applicantId);
    // System.out.println("UploadReferenceLettersAction.onCommit() - letterId = " + letterId);
    DCBindingContainer bc = ctx.getBindingContainer();
    DCIteratorBinding iter = bc.findIteratorBinding("ApplRefLetterView1Iterator");
    Row r = iter.getCurrentRow();
    r.setAttribute("ApplicantId",applicantID); // Setting value that is of type DBSequence
    // r.setAttribute("LetterId",letterID); // Setting value that is of type DBSequence
    /* Commit the transaction */
    System.out.println("UploadReferenceLettersAction.onCommit() - Saving upload starting");
    if (ctx.getEventActionBinding() != null) {
    ctx.getEventActionBinding().doIt();
    System.out.println("UploadReferenceLettersAction.onCommit() - Saving upload complete");
    ctx.setActionForward(ctx.getActionMapping().findForward("success"));
    public void onRollback(DataActionContext ctx) {
    System.out.println("*** UploadReferenceLettersAction.onRollback() ***");
    ctx.setActionForward(ctx.getActionMapping().findForward("Edit"));
    if (ctx.getEventActionBinding() != null) {
    ctx.getEventActionBinding().doIt();
    protected boolean handlingEvents(DataActionContext ctx) {
    List events = ctx.getEvents();
    return (events != null) && (events.size() > 0);
    </code>
    In my ApplicationModule, I have the following methods for adding and deleting code:
    <code>
    public void insertRowRefLetterView() {
    ViewObject vo = getApplRefLetterView1();
    Row aRow = vo.createRow();
    vo.insertRow(aRow);
    vo.setCurrentRow(aRow);
    public void deleteRefLetterByApplicantidLetterid(String applicantId) {
    Key k = new Key(new Object[] { new DBSequence(applicantId) });
    System.out.println("ApptrackModuleImpl.deleteRefLetterByApplicantidLetterid(applicantId) - key = " + k.toStringFormat(false));
    ViewObject vo = getApplRefLetterView1();
    Row[] r = vo.findByKey(k, 1);
    if (r.length < 1) {
    System.out.println("ApptrackModuleImpl.deleteRefLetterByApplicantidLetterid(applicantId) - No key to delete");
    } else {
    System.out.println("ApptrackModuleImpl.deleteRefLetterByApplicantidLetterid(applicantId) - Found key to delete");
    Row rowFound = r[0];
    String appId = rowFound.getAttribute("ApplicantId").toString();
    System.out.println("ApptrackModuleImpl.deleteRefLetterByApplicantidLetterid(applicantId) - appId = " + appId);
    rowFound.remove();
    return;
    </code>

    I ran again with the -Djbo.debugoutput=console
    There was one line that didn't seem right:
    EntityCache:add WARNING - new row key matches a removed row
    Shortly after this, I get the primary key violation.
    *** UploadReferenceLettersAction.onCommit() ***
    ApptrackModuleImpl.deleteRefLetterByApplicantidLetterid(applicantId) - key = 00010000000132
    ApptrackModuleImpl.deleteRefLetterByApplicantidLetterid(applicantId) - Found key to delete
    ApptrackModuleImpl.deleteRefLetterByApplicantidLetterid(applicantId) - appId = 2
    [472] OracleSQLBuilder Executing Select on: DCSAT_APPL_REF_LETTER (true)
    [473] Built select: 'SELECT APPLICANT_ID, LETTER_ID, LETTER_INF, CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE FROM DCSAT_APPL_REF_LETTER ApplRefLetter'
    [474] Executing LOCK...SELECT APPLICANT_ID, LETTER_ID, LETTER_INF, CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE FROM DCSAT_APPL_REF_LETTER ApplRefLetter WHERE APPLICANT_ID=:1 FOR UPDATE NOWAIT
    [475] QueryCollection: afterRemove(1)
    [476] ViewRowCache: removeReference, vr id = 6
    [477] Delete [DeleteEvent: ApplRefLetterView1 rowIndex=1 countB4=2 count=1 rmvFromTab=true]
    UploadReferenceLettersAction.onCommit() - applicantId = 2
    UploadReferenceLettersAction.onCommit() - Saving upload starting
    [478] EntityCache:add WARNING - new row key matches a removed row
    [479] [UpdateEvent: ApplRefLetterView1 rowIndex=0 attrIndices=0]
    [480] OracleSQLBuilder: SAVEPOINT 'BO_SP'
    [481] [UpdateEvent: ApplRefLetterView1 rowIndex=0 attrIndices=5]
    [482] [UpdateEvent: ApplRefLetterView1 rowIndex=0 attrIndices=6]
    [483] OracleSQLBuilder Executing, Lock 1 DML on: DCSAT_APPL_REF_LETTER (Insert)
    [484] INSERT buf ApplRefLetter>#i SQLStmtBufLen: 480, actual=178
    [485] BEGIN INSERT INTO DCSAT_APPL_REF_LETTER(APPLICANT_ID,LETTER_ID,LETTER_INF,CREATED_BY,CREATED_DATE,UPDATED_BY,UPDATED_DATE) VALUES (:1,:2,:3,:4,:5,:6,:7) RETURNING APPLICANT_ID INTO :8; END;
    [486] OracleSQLBuilderImpl.doEntityDML failed...
    [487] X/Open SQL State is: 23000
    [488] java.sql.SQLException: ORA-00001: unique constraint (APPTRACK.APPLREFLTR_PK) violated
    ORA-06512: at line 1
    Thanks! Ken

  • Unique constraint error on delete/insert

    Hi,
    I am using Jdeveloper 11.1.1.3.0. I have a ADF table where we can copy lines and delete lines. I get unique constraint error when I save. Looks like the insert operation in happening before the delete operation. Is there a way to set the execution order so that the logical behaviour is delete/update/insert.
    Thanks
    SV

    Hi,
    The unquie contraint is not from the primary key. There are three columns in the table (batch_id, line_number, line_type) which must be unique. In the UI, the user can delete lines, update lines and add lines and finally click the save button that does the commit. On delete the line_number gets re-numbered. So when committing, the unique error occurs because the line number already exists. Looks like insert is happening before update/delete. I cannot do commit after each delete/update/insert. I have to do it only if the user clicks the save button in the end. Is there a way to control the order of execution?
    SR

  • How to create a stored procedure that contains all 3 AFTER Triggers Update/Insert/Delete ?

    Hi guys, I'm trying to create a Stored procedure that will automatically add all 3 After triggers when executed on any given database, can someone please explain and give an example on how do I go about doing this ? I'd also like it to raise any errors
    that may come across, thanks in advance.

    Lets start with the question why do you need the triggers at all. Since SQL Server 2005 we can use an OUTPUT clause.
    This code can be re-written in SQL Server 2005 using the OUTPUT clause like below:
    create table itest ( i int identity not null primary key, j int not null unique )
    create table #new ( i int not null, j int not null)
    insert into itest (j)
    output inserted.i, inserted.j into #new
    select o.object_id from sys.objects as o
    select * from #new
    drop table #new, itest;
    go
    Now from this example, you can see the integration of OUTPUT clause with existing DML syntax.
    Another common scenario is auditing of data in a table using triggers. In this case, the trigger uses information from the inserted and updated tables to add rows into the audit tables. The example below shows code that uses OUTPUT clause in UPDATE and DELETE
    statements to insert rows into an audit table.
    create table t ( i int not null );
    create table t_audit ( old_i int not null, new_i int null );
    insert into t (i) values( 1 );
    insert into t (i) values( 2 );
    update t
       set i  = i + 1
    output deleted.i, inserted.i into t_audit
     where i = 1;
    delete from t
    output deleted.i, NULL into t_audit
     where i = 2;
    select * from t;
    select * from t_audit;
    drop table t, t_audit;
    go
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • DB insert after DB delete in a single program on the same table

    Hi All,
    A program is first deleting some records from a databse table ( assume Table1)
    and it is trying to insert the same records back to the table Table1 with the same
    primary keys.
    This program is defective. It does not check against the table
    Table1 to verify that the commit work is completed after the delete,
    As a result sometimes when the database performance is slow or the
    record is locked by some other user,  is it is trying to insert records
    into the table with the same primary keys even before the delete work
    is committed to the database. The program is unable to insert records
    into the table with the same primary keys and hence terminating it and
    creating the Short Dump Message.
    The delete is committed to the database even after the program is
    terminated with a Short Dump Message. This results in the old records
    being deleted  without the new updated records being inserted into the
    table Table1.
    Please suggest a solution this problem.

    Hi,
    You need to create a ENQUEUE Function module for this one, nad before doing the Deletion Lock the table/entries using the above function module and do the deletion and insert the records then write the fucntion moduel DEQUEUE to release the lock
    secondly, before inserting the records, why don't you check whehter the record is already there in the table with the same primary keu, if the record is existed with the same primay key then do not insert that record.
    Regards
    Sudheer

  • Insertion error after migration

    Hey,
    I'm getting this error when trying to insert a record in our application we just created. Anyone knows how to locate and fix this error ?
    ON-INSERT trigger raised unhandled exception ORA-20000
    Thanks

    Hey Sayeed,
    Here is my code for my save button that I click when I whant to insert a new record
    PROCEDURE save_button
    IS
    lv_button number;
    BEGIN
    if NAME_IN('PARAMETER.PA_LAST_CHOSEN_ALERT_BUTTON') is NULL
    then
    lv_button := ui_navigate_general.raise_alert('CAUTION', 'SAVE', '2');
    -- If user has chosen 'Yes' button
    if lv_button = ALERT_BUTTON1
    then
    COMMIT_FORM;
    end if;
    else
    ui_navigate_general.check_for_save_alert;
    lv_button := to_number(NAME_IN('PARAMETER.PA_LAST_CHOSEN_ALERT_BUTTON'));
    end if;
    -- If record is not saved, then clear the block and execute the query
    -- If not done this way, unsaved record on the screen can confuse the user.
    if lv_button = ALERT_BUTTON2
    then
    -- Make sure that form is on base table block and not on hierarchy block
    ui_navigate_general.stay_in_base_table_block;
    clear_block(NO_VALIDATE);
    execute_query;
    end if;
    -- enable delete button. Added on 3/19/99
    SET_ITEM_PROPERTY(gv_delete_button, ENABLED, PROPERTY_TRUE);
    -- disable save button
    SET_ITEM_PROPERTY(gv_save_button, ENABLED, PROPERTY_FALSE);
    END save_button;

  • ALV Operations like Insert,Delete,Change

    Hi all,Iam using 'REUSE_ALV_GRID_DISPLAY',my client want Insert/Delete/Change functionalities in my output.How to achive this? Any example?
    Please dont provide examples with classes,I want to do it with 'REUSE_ALV_GRID_DISPLAY' only.

    Check this program for reference to know how to change values
    BCALV_FULLSCREEN_GRID_EDIT
    Cheers,
    Kothand

  • Using delete/insert mode operator target in mapping

    Hello Guys,
    Can you help me please to resolve my problem. It's very urgent.
    I use OWB 10gR2 and I create a mapping for loading data from table to table.
    I got a source table A that I want to integrate into a table B.
    I want to put my target table B on delete/insert mode to delete data from B where A.annee = B.annee
    before inserting data from A.
    How to configure this mapping.
    Thanks in advance.
    Regards.
    fanfita.

    you dont have to do anything in particular:
    on the target table propperties click on the load type as Delete/Insert and specify the column which you need to check while deleting this can be done by clicking on the column of target table in your mapping and setting the properties such as "load while insert/delete/update etc" , you got to check the delete option of the columns that you want to check while deleting.
    If your target table has sequence then delete and insert will generate new sequence id and i am not sure if there is a Foregin key which needs to be considered here so it might be a better option to use update/insert
    if there are no dependencies at all then you can go for delete/insert option.
    Edited by: Darthvader-647181 on Feb 5, 2009 1:46 AM

  • Errors when trying to INSERT Dreamweaver CS3 ASP scripts into MySql

    Greetings everyone,
    I am hoping that someone can shed some light on an issue I have not been able to solve in the last few days. I have a website that I had built using Ultradev, then MX then CS3, using the default ASP scripts in dreamweaver and an odbc connection to an Access Database. Everything had been working fine for the last couple of years until recently where more people were visiting my site which resulted in the slowness because i was using access. I decided to move to a MySql database and that is when I ran into issues. I was able to solve most everything accept for one issue I am having. I was hoping it would be an easy transition by changing the ODBC connections but it has not been that easy. Any page I have with an INSERT command using the default Dreamweaver CS3 ASP script results in an error. Now I can query and delete and search with no problem...it is just the INSERT that is giving me issues. Here is just a general insertion script that CS3 does by default....
    <%
    If (CStr(Request("MM_insert")) = "form1")Then
    If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_adsdata_STRING
    MM_editCmd.CommandText = "INSERT INTO commenthot (yeshot, userhot) VALUES (?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 2, 3, Request.Form("yeshotf")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 3, 30, Request.Form("useridf")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    End If
    End If
    %>
    When I click to submit...the error i run into is...
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [MySQL][ODBC 3.51 Driver][mysqld-5.0.67-community-nt-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' mel)' at line 1
    /fr/members/sexyoupasvote.asp, line 28
    ....Line 28 is the MM_editCmd.Execute. I notice if I put a single quotes around the ? next the the VALUE like this ('?', '?')...it does go through and the ? shows up in both fields as the data.
    ....If i put a single back quote around the column names like this (`yeshot`, `userhot`) VALUES (?, ?) I get this error and nothing gets inserted into the MySql.
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [MySQL][ODBC 3.51 Driver][mysqld-5.0.67-community-nt-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' mel)' at line 1
    /fr/members/sexyoupasvote.asp, line 28
    ...by seeing 'mel)' show up, I know it is at least passing the data to that field.
    ....when I do (`yeshot`, `userhot`) VALUES ('?', '?')...
    it goes through and inserts ? ...instead of the real data I want to use...in this case ...the number 1 and Mel.
    ...if I do (yeshot, userhot) VALUES (?, '?')...
    I get this error...
    Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
    Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
    /fr/members/sexyoupasvote.asp, line 28
    ....any idea what to modify to make it insert the corect data? Has anyone experienced this? If I can get this fixed with just this page I can probablly fix the other pages that have teh same issue.  Is there a special setting on the MySql that I should know about to allow data to be inserted? Any help would GREATLY appreciated!
    Thank you!

    Thanks for your reply!
    When it was in Access...the datatype was Text. I used a 3rd party software to convert Assess directly to my hosting MySql server. When I logged in to see the table in MySql, it is set to Varchar(3) for yeshot and Varchar(30) for userhot. There is also an extra field I used for the KEY called commentID which is set to int(11) and it is autonumbered. Under the Collation i have utf8_general_ci set on the yeshot and userhot field. Null is No on both and the Default is set to None and all 3 fields.
    I have a form I am collecting that data from which is:
    <% If (langname.Fields.Item("langname").Value)="FR" Then
             response.write("OUI!")
             else
             response.write("YES!")
             End if %>
    <input name="yeshotf" type="radio" id="yeshotf" value="1" checked>                           
                                <span class="style10">
                                <input name="submit" type="submit" id="submit" value="VOTE!">
                                </span> -
    <input name="yeshotf" type="radio" id="yeshotf" value="2">
                                <% If (langname.Fields.Item("langname").Value)="FR" Then
             response.write("NON!")
             else
             response.write("NO!")
             End if %>
                                <input name="useridf" type="hidden" id="useridf" value="<%=(hotornot.Fields.Item("membername").Value)%>">
                                <input type="hidden" name="MM_insert" value="form1">
                              <input type="hidden" name="hdwfail" id="hdwfail" value="sexyoupasvote.asp?langname=<%=(langname.Fields.Item("langname").Value)%>&membernam e=<%=(hotornot.Fields.Item("membername").Value)%>&hdwmsg=invalid">
    </form>
    ....the form has 2 radio button and 1 hidden field where I collect the username. The radio value should either be a 1 or a 2 depending on the selection by the user. I also have a captha on the form but that does not seem the cause any problem since I am not collecting any data from it. Does this help? I left the yeshot field as Text but I can change that to Numeric data... again thanks for your assistance in helping me try to figure this out.
    ...The message I am getting now is:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [MySQL][ODBC 3.51 Driver][mysqld-5.0.67-community-nt-log]Unknown column 'Babe1' in 'field list'
    /fr/members/sexyoupasvote.asp, line 28
    ....with this setting:
    <%
    If (CStr(Request("MM_insert")) = "form1") Then
      If (Not MM_abortEdit) Then
        ' execute the insert
        Dim MM_editCmd
        Set MM_editCmd = Server.CreateObject ("ADODB.Command")
        MM_editCmd.ActiveConnection = MM_adsdata_STRING
        MM_editCmd.CommandText = "INSERT INTO dsnrenms.commenthot (yeshot, userhot) VALUES (?, ?)"
        MM_editCmd.Prepared = true
        MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 3, Request.Form("yeshotf")) ' adVarWChar
        MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 30, Request.Form("useridf")) ' adVarWChar
        MM_editCmd.Execute
        MM_editCmd.ActiveConnection.Close
      End If
    End If
    %>

  • Edit/delete/insert forms using php

    Hi,
    I have created an application that will allow me to
    edit/delete/insert data to my database using php.
    The functions work. But when I click on a tab i get an error
    like this:
    ypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at
    StoreManagement/runFeed()[C:\adobeStoreManagement\StoreManagement\src\StoreManagement.mxm l:26]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
    mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\co re\UIComponent.as:9051]
    at
    mx.containers::ViewStack/dispatchChangeEvent()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\containers\ViewStack.as:1165]
    at
    mx.containers::ViewStack/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\containers\ViewStack.as:672]
    at
    mx.containers::TabNavigator/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework \src\mx\containers\TabNavigator.as:504]
    at
    mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\ mx\core\UIComponent.as:5670]
    at
    mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framewor k\src\mx\managers\LayoutManager.as:519]
    at
    mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:669]
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at
    mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
    at
    mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]
    Also the first time I click on the edit program link it
    doesnt show any data in the combo. Then when I click on new store.
    It fills up the comboboxes. When I go back to the edit program tab.
    It now also has the data inside the combobox.
    When I add a new program, store or categorie. It says
    operation succesfull. But the new program is not added to the new
    comboboxes. I have to close the browser and rerun the application.
    Then it shows the entered value inside the comboboxes.
    I have attached all my code for this application, any help
    would be greatly appreciated. Also could you advise me on what is
    the best approach to do this?
    With friendly regards,
    Thomas

    A few things:
    * Do not use lastResult in AS code. It is intended for use in
    binding expressions only. I suspect that it is the cause of your
    error, since it will not yet exist where you are trying to
    reference it.
    * All data service calls in Flex are asynchronous. this means
    you can *never* access the result data in the same function you
    call send(), as you are attempting.
    * Use a result handler for all HTTPService calls
    * Your data model methodology is *good*, using instance vars
    to hold ArrayCollections, and binding to those vars. Just set the
    vars in a result handler, instead of in the send function
    * the default resultFormat of HTTPService is object. This
    causes Flex to convert the HTTPService XML into a tree of dynamic
    objects. While it provides a quick start, it has long term
    drawbacks. I advise setting resultFormat="e4x", so that youcan use
    the powerful e4x XML API on your data.

  • Sybase Error 2601 Attempt to insert duplicate key row in object with unique

    RE: Sybase Error 2601 Attempt to insert duplicate key row in object with unique index.
    Hi Folks,
    I'm getting the following error whilst executing a stored procedure in Sybase.
    ERROR: Sybase Error 2601 Attempt to insert duplicate key row in object with unique index.
    I understand that duplicate values have been inserted into a column that has a unique constraint.
    I just can't figure out how to rectify the problem.
    Your help will be greatly appreciated!
    Many thanks in advance.

    If the value I'm trying to insert (using update)
    already exists in the unique-value field then the DB
    refuses to update the field.
    If the value is different it will update.Are you trying to insert or update in SQL (identified by the keyword INSERT or UPDATE respectively)?
    Even in case of an UPDATE query, if you are going to update the values of some columns to violate the unique constraints, the update will not succeed and you will get the error message.
    or is it?
    it tries to create a new row, but can't because there
    is another row with the same unique-values.
    If this is the case, I am only trying to update and
    not create a new item.To put it in simpler words, if you have a set of values defining the uniqueness of a record, you cannot insert another record with the same set of unique values. Similarly, you cannot update an existing record by modifying the set to conflict with another set of unique values which already exist in the database.
    Suppose there are two columns A and B defining the uniqueness of the record and you have only two records at the moment like -
    A B
    ========
    1 1
    2 1
    If you try to insert a record with A = 1 and B = 1, it will fail because a record already exists. You cannot violate uniqueness because the database has already been told that there will be only one record for any given combination of A and B.
    Similarly, if you try to update the second record from A = 2 to A = 1, the end result would be A =1 and B = 1. There is already a record with that set of values and this will result in a violation of the uniqueness. So, this update will also be disallowed. On the other hand, if you try to update B to some value, say 3, there is no problem in doing so.
    For convenience, you can imagine an UPDATE operation to be equivalent to DELETE + INSERT operation, though it doesn't necessarily work the same way internally.
    I hope I was clear enough.

  • Insert,delete,update in oracle Rac11g2

    hi all.
    i am using oracle grid 11g R2,oracle database 11g R2 and oracle Linux Enterprise 5.5.
    i tried to use insert,update and delete in oracle Rac but wihout commit iit did not delete,update and insert in Node2.
    plz can anyone help me that how to insert,delete and update without issuing commit in node1 and perform the action
    on node2 as well?
    Kelly

    Hi Kelly,
    Now I get it, but unfortunately there is no way to do it. TAF can allow only session failover, or query failover (a running query will continue in the other node). But anyway, there is no way to failover a transaction. The transaction will be rolled back automatically (no question or any other option) and the session will get an error. However, the session will be connected to the other node and can continue working or retry the operation.
    HTH
    Liron

  • Update/insert/delete data from xcelsius to Database via web service

    Hi,
    I need to create dashboard that go function can <b>update/insert/delete</b> data send to <u>Database</u> thru <u>web services</u>, as i know got 2 xcelsius add-on software which support those of function <b>InfoBurst</b> and <b>flynet </b>
    <b>InfoBurst</b>
    http://www.infosol.com/azbocug/minutes/4-Writeback%20to%20a%20Database%20with%20Xcelsius.pdf
    <b>flynet </b>
    http://www.flynetviewer.com/public/community/Blogs/FlynetXcelsiusServerUser/default.aspx
    Except this 2 purchase add-on xcelsius, any other solution ?  
    Maybe need to write some in MSSQL or C# programming which enable insert, update, delete ...etc  ?
    *note: i not use Xcelsius Engage Server , i use Xcelsius Engage only
    thanks,
    regards
    s1
    Edited by: Leong Pui Kee on Mar 1, 2011 6:06 AM

    Hi,
    As of now in Xcelsius/Dashboard Design there is no feature or functionality to insert/update/delete data from database.
    Solution:
    Create a Web service in let’s say C# or Java, which will perform insert/update/delete operation.
    In Xcelsius add Web Service connection and user above web service.
    Xcelsius Web Service connection provides option to pass input values to a Web Service (Input Pane) and get the result (Output values pane).
    We can pass values to be written to the database as a input to Web Service via Web Service connection from Xcelsius and write data to the database.
    Note:
    Performing delete operation from Xcelsius Dashboard could be risky and may delete important data from database. I would not prefer giving delete option/functionality in Xcelsius dashboard.
    Hope this helps!
    Thank you.
    Regards,
    Vinay Mhaske

Maybe you are looking for