Primary Key Conflicts While Inserting Rows

Hi,
I am inserting some rows into a table which has primary key constraints on columns 1,2,3. I have set the key columns in my program to 1,2,3. When I try to insert a row it throws a syncresolver exception stating that there is a key conflict. But i don't understand why it is doing this because there is no conflict. I can remove the primary key constraints off the sql table (but still leave them on in the program) and it will insert everything correctly.
Any ideas?
Thanks

Using SQL Server 2005 Drivers.
import java.sql.*;
import javax.sql.rowset.*;
import com.sun.rowset.*;
public class TestDB {
     public static void main(String[] args){
          String connectionUrl = "jdbc:sqlserver://DBSERVER;DatabaseName=fTrack;user=sa;password=1234";
          // Declare the JDBC objects.
          Connection con = null;
          CachedRowSet crs = null;
          int keys[] = {1,2,3};
          try {
               // Establish the connection.
               Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
               con = DriverManager.getConnection(connectionUrl);
               // Create and execute an SQL statement that returns some data.
               String SQL = "SELECT * FROM pt_OMS_Data WHERE Switch=4";
               crs = new CachedRowSetImpl();
               crs.setCommand(SQL);
               crs.execute(con);
               crs.setKeyColumns(keys);
               crs.beforeFirst();
               crs.moveToInsertRow();
               crs.updateInt(1, 5);
               crs.updateTimestamp(2, Timestamp.valueOf("2007-07-20 00:00:00"));
               crs.updateInt(3, 0);
               crs.insertRow();
               crs.moveToCurrentRow();
               crs.moveToInsertRow();
               crs.updateInt(1, 5);
               crs.updateTimestamp(2, Timestamp.valueOf("2007-07-20 00:00:00"));
               crs.updateInt(3, 1);
               crs.insertRow();
               crs.moveToCurrentRow();
               crs.acceptChanges(con);
          // Handle any errors that may have occurred.
          catch (Exception e) {
               e.printStackTrace();
          } finally {
               if (crs != null)
                    try {
                         crs.close();
                    } catch (Exception e) {
               if (con != null)
                    try {
                         con.close();
                    } catch (Exception e) {
}Layout of DB:
Switch Date BSC ColA ColB ColC
Switch, Date, and BSC are the PKs.
Switch is type Int, Date is type datetime, BSC is type int
Here is the error which i receive:
javax.sql.rowset.spi.SyncProviderException: 4 conflicts while synchronizing
     at com.sun.rowset.internal.CachedRowSetWriter.writeData(Unknown Source)
     at com.sun.rowset.CachedRowSetImpl.acceptChanges(Unknown Source)
     at com.sun.rowset.CachedRowSetImpl.acceptChanges(Unknown Source)
     at TestDB.main(TestDB.java:39)
I inserted the exact same data manually into the DB and it works fine.
By the way, the program inserts the first row, but not the second. Based on my trials with the original program I am working on the syncproviderexception handler seems to have a conflict on insert row on Switch column. This is why I believe java is not interpreting the PKs as a group but rather as individually.
Message was edited by:
bce_developer

Similar Messages

  • Database got halted while inserting rows

    I have a 9i database running on solaris not restarted for 15 days.It just got halted or hanged while inserting rows in a table.When restarted everything is just fine and those rows have been inserted in no time!!What might be the reason?Dont tell me 'lock' because I have already checked for ora:60 error in alertlog.Would you please give some direction to drill it down .

    Did you met the problem , only when you inserting the rows ? Or is there something else which leads this situation ? most of the occasion when
    you found your database halt is because of your archivelogs . I would
    still like to know if you running your db in archivelog mode ? It also be the
    case that you set archive_log_start = true in the pfile and diden't fire
    alter database archivelog at the sql prompt .
    Hare Krishna
    Alok

  • How to Create primary key index with duplicate rows.

    Hi All,
    While rebuilding an index on a table , I am getting error that there are duplicate rows in a table.
    Searching out the reason led me to an interesting observation.
    Please follow.
    SELECT * FROM user_ind_columns WHERE table_name='SERVICE_STATUS';
    INDEX_NAME     TABLE_NAME     COLUMN_NAME     COLUMN_POSITION     COLUMN_LENGTH     CHAR_LENGTH     DESCEND
    SERVICE_STATUS_PK     SERVICE_STATUS     SUBSCR_NO_RESETS     2     22     0      ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     STATUS_TYPE_ID     3     22     0     ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     ACTIVE_DT     4     7     0     ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     SUBSCR_NO     1     22     0     ASC
    SELECT index_name,index_type,table_name,table_type,uniqueness, status,partitioned FROM user_indexes WHERE index_name='SERVICE_STATUS_PK';
    INDEX_NAME     INDEX_TYPE      TABLE_NAME     TABLE_TYPE     UNIQUENESS     STATUS     PARTITIONED
    SERVICE_STATUS_PK     NORMAL     SERVICE_STATUS     TABLE     UNIQUE     VALID     NO
    SELECT constraint_name ,constraint_type,table_name,status,DEFERRABLE,DEFERRED,validated,index_name
    FROM user_constraints WHERE constraint_name='SERVICE_STATUS_PK';
    CONSTRAINT_NAME     CONSTRAINT_TYPE     TABLE_NAME      STATUS     DEFERRABLE     DEFERRED     VALIDATED     INDEX_NAME
    SERVICE_STATUS_PK     P     SERVICE_STATUS     ENABLED     NOT DEFERRABLE     IMMEDIATE VALIDATED     SERVICE_STATUS_PK
    1. Using index scan:
    SELECT COUNT (*)
    FROM (SELECT subscr_no, active_dt, status_type_id, subscr_no_resets
    FROM service_status
    GROUP BY subscr_no, active_dt, status_type_id, subscr_no_resets
    HAVING COUNT (*) > 1) ;
    no rows returned
    Explain plan:
    Operation     OBJECT Name     ROWS     Bytes     Cost     OBJECT Node     IN/OUT     PStart     PStop
    SELECT STATEMENT Optimizer MODE=CHOOSE          519 K          14756                     
    FILTER                                        
    SORT GROUP BY NOSORT          519 K     7 M     14756                     
    INDEX FULL SCAN     ARBOR.SERVICE_STATUS_PK     10 M     158 M     49184                     
    2. Using Full scan:
    SELECT COUNT (*)
    FROM (SELECT /*+ full(s) */ subscr_no, active_dt, status_type_id, subscr_no_resets
    FROM service_status s
    GROUP BY subscr_no, active_dt, status_type_id, subscr_no_resets
    HAVING COUNT (*) > 1) ;
    71054 rows returned.
    Explain Plan:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          1           24123                     
    SORT AGGREGATE          1                               
    VIEW          519 K          24123                     
    FILTER                                        
    SORT GROUP BY          519 K     7 M     24123                     
    TABLE ACCESS FULL     ARBOR.SERVICE_STATUS     10 M     158 M     4234                     
    Index SERVICE_STATUS_PK is a unique and composite primary key VALID index. And the constraint is ENABLED and VALIDATED still having duplicate rows in table.
    How it is possible?
    Is it an Oracle soft Bug??
    Regards,
    Saket Bansal

    saket bansal wrote:
    Values are inserted as single rows inserts through an GUI interface.And you still claim to have over 71K duplicate records, without the GUI getting any kind of errors?
    That does not add up and can only be explained by a "bug".
    I tried inserting a duplicate record but failed.
    SQL> insert into service_status (select * from service_status where rownum <2);
    insert into service_status (select * from service_status where rownum <2)
    ERROR at line 1:
    ORA-00001: unique constraint (ARBOR.SERVICE_STATUS_PK) violatedAre you really sure there is no other way data in this table is populated/manipulated in bulk?

  • Error while inserting rows in a table

    Hi,
    We have recently migrated from 9i to 10g. We have a scheduled job out our DB which first deletes all the rows from a table and then inserts them back by selecting rows from 5 tables. This table has a composite primary key based on 6 columns in it. In 9i, when i try to insert rows into the table after deleting all the rows from it, I am able to insert the data successfully . However, in 10g, when i try doing the same operation, it fails with the ORA error:
    ORA-00001: unique constraint violated
    The same query which works perfectly in 9i fails in 10g
    If anybody has some ideas on how to resolve the same, kindly let me know.
    Thanks in advance.

    Hi,
    I was finally able to resolve the reason behind that error message and found it even more weird. The error was because I was using the substr function for extracting the characters 1-4 from a column which is 5 characters long. When i specify the query as:
    select substr(column1, 1, 4)) from table1;
    only the characters 1-3 are retrieved. Now if i change the query to select substr(column1, 1, 5)) from table1, in that case also only 3 characters are retrieved although i have specified the substr to start from 1 and read till 5 characters. Also, when i run the query:
    select length(substr(column1, 1, 4)) from table1 or select length(substr(column1, 1, 5)) from table1
    I get the answer as 3.
    However, the most amazing part is that the query is working perfectly in 9i and is retrieving the data correctly i.e. from substr 1-4.
    Can anyone suggest what the problem could be?
    Thanks
    Edited by: CrazyAnie on May 13, 2009 1:34 AM

  • Primary key violation when inserting records with insert_identity and ident_current+x

    My problem is this: I have data in a couple of temporary tables including
    relations (one table referencing records from another table by using
    temporary keys).
    Next, I would like to insert the data from the temp tables to my productive tables which have the same structure but their own identity keys. Hence, I need to translate the 'temporary' keys to regular identity keys in my productive tables.
    This is even more difficult because the system is highly concurrent, i.e. multiple sessions may try to insert
    data that way simultaneously.
    So far we were running the following solution, using a combination of
    identity_insert and ident_current:
    create table doc(id int identity primary key, number varchar(100))
    create table pos (id int identity primary key, docid int references doc(id), qty int)
    create table #doc(idx int, number varchar(100))
    create table #pos (docidx int, qty int)
    insert #doc select 1, 'D1'
    insert #doc select 2, 'D2'
    insert #pos select 1, 10
    insert #pos select 1, 12
    insert #pos select 2, 32
    insert #pos select 2, 9
    declare @docids table(ID int)
    set identity_insert doc on
    insert doc (id,number)
    output inserted.ID into @docids
    select ident_current('doc')+idx,number from #doc
    set identity_insert doc off
    -- Since scope_identity() is not reliable, we get the inserted identity values this way:
    declare @docID int = (select min(ID) from @docids)
    insert pos (docid,qty) select @docID+docidx-1, qty from #pos
    Since the request to ident_current() is located directly in the insert statement, we always have an implicit transaction which should be thread safe to a certain extend.
    We never had a problem with this solution for years until recently when we were running in occasional primary key violations. After some reasearch it turned out, that there were concurrent sessions trying to insert records in this way.
    Does anybody have an explanation for the primary key violations or an alternative solution for the problem?
    Thank you
    David

    >> My problem is this: I have data in a couple of temporary tables including relations (one table referencing records [sic] from another table by using temporary keys [sic]). <<
    NO, your problem is that you have no idea how RDBMS and SQL work. 
    1. Rows are not anything like records; this is a basic concept.
    2. Temp tables are how old magnetic tape file mimic scratch tapes. SQL programmers use CTEs, views, derived tables, etc. 
    3. Keys are a subset of attributes of an entity, fundamental characteristics of them! A key cannot be temporary by definition. 
    >> Next, I would like to insert the data from the temp tables to my production tables which have the same structure but their own IDENTITY keys. Hence, I need to translate the 'temporary' keys to regular IDENTITY keys in my productive tables. <<
    NO, you just get worse. IDENTITY is a 1970's Sybase/UNIX dialect, based on the sequential file structure used on 16-bit mini computers back then. It counts the physical insertion attempts (not even successes!) and has nothing to with a logical data model. This
    is a mag tape drive model of 1960's EDP, and not RDBMS.
    >> This is even more difficult because the system is highly concurrent, i.e. multiple sessions may try to insert data that way simultaneously. <<
    Gee, that is how magnetic tapes work, with queues. This is one of many reasons competent SQL programers do not use IDENTITY. 
    >> So far we were running the following solution, using a combination of IDENTITY_INSERT and IDENT_CURRENT: <<
    This is a kludge, not a solution. 
    There is no such thing as a generic “id” in RDBMS; it has to be “<something in particular>_id” to be valid. You have no idea what the ISO-11179 rules are. Even worse, your generic “id” changes names from table to table! By magic, it starts as a “Doc”,
    then becomes a “Pos” in the next table! Does it wind up as a “doc-id”? Can it become a automobile? A squid? Lady Gaga? 
    This is the first principle of any data model; it is based on the Law of Identity; remember that from Freshman Logic 101? A data element has one and only one name in a model. 
    And finally, you do not know the correct syntax for INSERT INTO, so you use the 1970's Sybase/UNIX dialect! The ANSI/ISO Standard uses a table consrtuctor: 
    INSERT INTO Doc VALUES (1, 'D1'), (2, 'D2'); 
    >> We never had a problem with this solution for years until recently when we were running in occasional PRIMARY KEY violations. After some research it turned out, that there were concurrent sessions trying to insert records [sic] in this way. <<
    “No matter how far you have gone down the wrong road, turn around.” -- Turkish proverb. 
    You have been mimicking a mag tape file system and have not written correct SQL. It has caught up with you in a way you can see. Throw out this garbage and do it right. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • SQL- Obtaining primary key in newly inserted data

    Anyone know of an easy way to obtain a primary autonumber key from a newly inserted record ??
    Martin

    "Martin Eder" wrote:
    >This is a multi-part message in MIME format.>>------=_NextPart_000_0010_01C07707.14E4F6C0>Content-Type:
    text/plain;> charset="iso-8859-1">Content-Transfer-Encoding: quoted-printable>>Anyone
    know of an easy way to obtain a primary autonumber key from a =>newly inserted
    record ??>>Martin>>------=_NextPart_000_0010_01C07707.14E4F6C0>Content-Type:
    text/html;> charset="iso-8859-1">Content-Transfer-Encoding: quoted-printable>>
    HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">>>content=3D"text/html; =>charset=3Diso-8859-1">>name=3DGENERATOR>>>>>
    face=3DArial size=3D2>Anyon
    e know of an easy way to obtain a =>primary=20>autonumber
    key from a newly inserted record ??>
    size=3D2> >Martin>>------=_NextPart_000_0010_01C07707.14E4F6C0-->
    Yes, for MS SQL7 modify the EasySQL vi to execute the SQL command 'SELECT
    @@IDENTITY' the query results will contain the identity of the inserted row.

  • ?Trigger to return primary key value after insert"

    Ok, so I'm a newbie to oracle. I was hoping someone could tell
    me how I can get the value of a field after insertion. I
    created a sequence and a trigger to autoincrement the primary
    key. I figured out that select @@Identity does not work. So
    I'm trying to figure out how to return the primary key value of
    just inserted record.
    Any help or suggestions would be really appreciated.
    thanks matt

    I have 3 tables - master, detail and collector.
    when a record is inserted into the collector table - I want to fire a trigger and insert the value of "collector.a_test", "collector.b_test" into "master.test" and "detail.test" respectively.
    I want to create an after/insert trigger on the collector table to accomplish this. I tried to implement the example listed in previous message (see below) *** BUT **** I get a PLS-00103 error - "Encountered the symbol "A_ID" when expecting one of the following: :=. ( @ %;
    Note: master, detail and collector have before insert trigger/sequence that assigns their PK values.
    master has 2 columns - a_id (number PK), a_test (varchar2(255))
    detail has 3 columns - b_id (number PK), b_test (varchar2(255)), aa_id (number FK)
    collector has 3 columns - c_id (number PK), a_test (varchar2(255)), b_test (varchar2(255))
    as in;
    create or replace trigger wf.c_a_b_insert
    after insert on wf.collector
    referencing old as old new as new
    for each row
    declare
    aa_id master.a_id%type;
    begin
    insert into master (a_test) values(:new.a_test);
    returning a_id into aa_id;
    /* now insert into detail and get the FK value from aa_id */
    end;
    What am I doing wrong and how can I fix this?
    Thanks much!
    Bill G...

  • Primary key generation by insert trigger.

    I have a table and wish to automatically create a unique sequence number for use as the primary key.
    In PL/SQL I do something like this:
    create sequence personnel_seq;
    create or replace trigger personnel_insert
    before insert on personnel
    for each row
    declare seqNo NUMBER;
    begin
    select personnel_seq.NextVal into seqNo from dual;
    :new.vc_personnel_reference := seqNo;
    end personnel_insert;
    column personnel.vc_personnel_reference is the primary key of table personnel, and not null.
    What's the recommended way to do something similar in BC4J?
    At present I'm using the trigger but BC4J doesn't know it exists, and insists on a value for vc_personnel_reference being provided. It also insists on adding the primary key to the ViewObject's attributes.
    I can provide a dummy value in ViewObjectRowImpl.insertRow() but this seems cumbersome.
    Is there a better way?
    In fact can I do this kind of thing entirely in BC4J without the trigger?
    Tony.

    But be carefull with DBSequences.
    There's a "problem" because the DBSequencs is a Domain and a "domained" field is not equal to any other field.
    In that case if have an Entity with Id = 1 (where d comes out from a DbSequence) and You look for Id = n where n is a Number containing 1, You will not find Your record !!!
    As 9.0.2.; I don't know in 9.0.3.
    Bye
    Tullio

  • Modify Primary Key Value while present in child tables

    Hi,
    I have one master table having primary key "ESTNO" and 10 child tables having ESTNO as the part of their primary key / composit key. I need to update the value of ESTNO in a master and associated child tables. what should i do to accomplish this...
    Regards.

    I think the trigger is the best solution to a bad problem. Having just tested it, I can confirm that putting the code in the AFTER UPDATE ... FOR EACH ROW trigger does not require us to make the foreign key deferred (at least in 9.2, I assume that also applies in earlier versions).
    Cheers, APC
    ALTER TABLE t2 ADD CONSTRAINT t2t1_fk FOREIGN KEY (col2) REFERENCES t1(col1)
    SQL> CREATE OR REPLACE TRIGGER "APC_LOAD"."T1_AUR" AFTER
      2  UPDATE ON "APC_LOAD"."T1" FOR EACH ROW BEGIN
      3  IF :NEW.col1 <> :OLD.col1 THEN
      4     UPDATE t2
      5     SET t2.col2 = :new.col1
      6     WHERE t2.col2 = :old.col1;
      7  END IF;
      8* END ;
      9  /
    Trigger created.
    SQL> UPDATE t1 SET col1 = 1 WHERE rownum = 1;
    SQL> SELECT count(*) FROM t1 WHERE col1 = 1;
      COUNT(*)
             1
    SQL> SELECT count(*) FROM t2 WHERE col2= 1;
      COUNT(*)
             1
    SQL>  UPDATE t1 SET col1 = 87979 WHERE col1 = 1;
    1 row updated.
    SQL> SELECT count(*) FROM t2 WHERE col2= 1;
      COUNT(*)
             0
    SQL>
    SQL> SELECT count(*) FROM t2 WHERE col2= 87979;
      COUNT(*)
             1
    SQL>        

  • Entity primary key conflict

    I created the following table :
    Table1: primary key:pk
    Table2:primary key:(pk,pk1) and foreign key(pk) ex:table (pk,pk1,a,b,c... ) are the columns
    table3:primary key:(pk,pk2) and foreign key(pk,pk1) ex:(pk,pk1,pk2,h,i,j,) are the columns
    when trying to insert in Table 3 the pk2 is not inserted the value is always null.
    i couldn't find what the problem with this table structure the entity class work fine but when i am invoking tableEntity.getCollection.add(table2entity);
    then invoke persist...
    this one is not added.
    any help will be very appreciated
    thank you

    I created the following table :
    Table1: primary key:pk
    Table2:primary key:(pk,pk1) and foreign key(pk) ex:table (pk,pk1,a,b,c... ) are the columns
    table3:primary key:(pk,pk2) and foreign key(pk,pk1) ex:(pk,pk1,pk2,h,i,j,) are the columns
    when trying to insert in Table 3 the {color:#ff0000}pk1{color} is not inserted the value is always null.
    i couldn't find what the problem with this table structure the entity class work fine but when i am invoking tableEntity.getCollection.add(table2entity);
    then invoke persist...
    this one is not added.
    the logical structure of the tables seem to be ok and the entities class work fine.
    any help will be very appreciated
    thank you

  • ORA-02266: unique/primary keys - error while using Exchange Partition

    Hi All,
    While using EXCHANGE PARTITION statement as given below,
    ALTER TABLE SOURCE_TABLE EXCHANGE PARTITION PRT_EXCG_PRTN WITH TABLE TARGET_TABLE
    we are getting this error,
    ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    However, there are no tables have foreign keys referring this TARGET_TABLE, we checked this by referring
    USER_CONSTRAINTS table, it has only primary key and NOT NULL constraints.
    SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME like 'TARGET_TABLE';
    We are using the following version,
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE     9.2.0.6.0     Production
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    Is it due to any error in our end or it could be a bug in Oracle and should we go for any patch updation ?
    Please guide us to resolve this error as soon as possible, thank you.
    Regards,
    Deva

    *** Duplicate Post ***
    Please Ignore.

  • How to get the new Primary Key after the Automatic Row Processing (DML)

    Hi,
    I have a nice master detail form.
    I want, immediately after submitting the page when creating a new record in the master table, that the user may input the associated table (the detail table). For that I have created a branch that goes back to the very same page after creating the record (ie submitting the page with the button Create). In the Action of the branch, i have put P30_FICHE_ID (the item containing the primary key of the master table) with its value : &P30_FICHE_ID.
    Unfortunately I see that the item is not populated with the very new primary key. it seems normal becaus after submitting the page the tiem is not populated. This is my question : how to retrieve the newly created primary into the item P30_FICHE_ID in order to begin immediately to add rows to the detail table ?
    Hope I'm clear. My english not perfect.
    Thank you for your kind help !
    Christian
    Edited by: Christian from France on Oct 16, 2009 6:36 AM

    Christian,
    After creating Master-detail form, goto your Detail page. In this page you can see one conditonal brach which will point to 'Master' page.
    Edit this branch and here you can see this branch fires when request is in 'SAVE,DELETE,CREATE' (in Expression1). Now change the value in Expression1 to 'SAVE,DELETE'. This will do the needful :-)
    Cheers
    Hari
    Edited by: Hari_639 on Oct 16, 2009 8:02 PM

  • Generate the primary key  automatically while records are saved

    Hi experts,
    I need to generate the primary key of a custom table automatically when a new record is saved. Pleas help asap. Urgent.

    Hi Rob and vikas,
       Thanks for your answers . Both of the solutions you mentioned were syntactically correct and activated but they are not populating the numbers.In case of Rob's soultion  I guess I am not able to catch the return number. I am giving the code below. So Please look into it,
    FORM gen_manu_siteid .
    data : number type zsiteid value 155.
    CALL FUNCTION 'NUMBER_GET_NEXT'
      EXPORTING
        NR_RANGE_NR                   = '02'
        OBJECT                        = 'zmanusite'
        QUANTITY                      = '1'
      SUBOBJECT                     = ' '
      TOYEAR                        = '0000'
      IGNORE_BUFFER                 = ' '
      IMPORTING
        NUMBER                        = number
      QUANTITY                      =
      RETURNCODE                    =
    EXCEPTIONS
      INTERVAL_NOT_FOUND            = 1
      NUMBER_RANGE_NOT_INTERN       = 2
      OBJECT_NOT_FOUND              = 3
      QUANTITY_IS_0                 = 4
      QUANTITY_IS_NOT_1             = 5
      INTERVAL_OVERFLOW             = 6
      BUFFER_OVERFLOW               = 7
      OTHERS                        = 8
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    ztblqm_sqm-zsiteid = number .
    ENDFORM.                    " gen_manu_siteid
    When this did not work. i tried Vikas's soution and the code i used for this is
    FORM gen_manu_siteid .
    data : w_count like ztblqm_sqm-zsiteid,
           e_wa like ztblqm_sqm occurs 0 with header line.
    select max( zsiteid ) from ztblqm_sqm into w_count .
    w_count = w_count + 1.
    e_wa-zsiteid = w_count.
    modify ztblqm_sqm  from e_wa.
    ENDFORM.                    " gen_manu_siteid
    Please look into this and give me a solution.
    NB: I have tried them at the event 01 include.

  • Ability to auto create a primary key column while creating an entity ?

    Product : oracle data modeler ( 3.0.0.665 32 bit version ) on windows XP Professional , : Target DB Oracle 11GR2
    I am new to Mozilla Rhino. Is it feasible to have a mechanism where in the primary key column name would be auto generated when the entity ( name ) is just created for the first time, and it has no columns defined yet . For e.g. one could create an entity named vendor , and after the table name is typed in, a column vendor identifier,of type numeric , is to be auto created. This mechanism should work even if the entity name changes, and the primary key is in format {tablename}_id , but it should not , if the primary key was manually set in later and is not in the expected format.

    I created this script (1) for adding an ID column (using a specific domain) to all supertype entities that do not already have an ID attribute, and a script (2) for adding primary key constraints to all ID attributes.
    - Marc de Oliveira
    Script 1:
    entities = model.getEntitySet().toArray();
    domain = model.getDesign().getDomainSet().getByName('Integer DIS Domain');
    for (var e = 0; e<entities.length;e++)
    entity = entities[e];
    if (entity.getHierarchicalParent()==null)
    attributes = entity.getAttributes().toArray(); // find existing attributes
    IDattribute = null;
    for (var a = 0; a<attributes.length; a++) // look for an ID attribute
    if (attributes[a].getName()=="ID") { IDattribute = attributes[a]; }
    if (IDattribute==null) // if an ID attribute was not found...
    IDattribute = entity.createAttribute(); // create a new ID attribute
    IDattribute.setName("ID");
    IDattribute.setDomain(domain);
    entity.moveToIndex(IDattribute,0); // move ID attribute to top
    Script 2:
    entities = model.getEntitySet().toArray();
    for (var e = 0; e<entities.length;e++)
    entity = entities[e];
    attributes = entity.getAttributes().toArray(); // find existing attributes
    IDattribute = null;
    for (var a = 0; a<attributes.length; a++) // look for an ID attribute
    if (attributes[a].getName()=="ID") { IDattribute = attributes[a];}
    if (IDattribute!=null) // if an ID attribute was found...
    key = entity.createCandidateKey(); // Create a key
    key.add(IDattribute); // Add the ID attribute to the key
    key.setPK(true); // Define the key as a primary key
    PKName = entity.getName().replace(" ","_")+"_PK";
    key.setName(PKName); // Define the key as a primary key
    entity.setPK(key); // workaround for bug...
    }

  • UI API: Poor performance in Goods Receipt (PO) while inserting rows

    Hi all,
    we wrote small procedure, where we import some data from .txt file into Good Receipt (PO) document. There is no many infos there, we fill only these columns in GR matrix:
    ItemCode, Quantity, Warehouse
    For inserting data into document's row we use this code:
    oItCdCol.Cells(lRow).Specific.Value = Trim(sItm)
    oQtyCol.Cells(lRow).Specific.Value = Trim(sQty)
    oWHSCol.Cells(lRow).Specific.Value = Trim(sWHS)
    lRow = lRow + 1
    but with more than 30 lines in import file the performance is very poor, with cca. 300 lines it takes many hours. The GoodReceipt form is during import freezed of course.
    We use SBO2005 SP01 Patch 22. Is there performance problem with documents generally in this patch or something else?
    Thanks in advice.
    Kind regards
    Libor Mego.

    Are you working with Visual Basic 6 or Visual Basic from Visual Studio?.
    If you response VS, then try to use directly
    oItCdCol.Cells(lRow).Specific.Value = sItm.<b>Trim</b>()
    There is not the same througputh with olders function versus the newest.
    My recomendation is the same from Microsoft, "enjoy" always to use the Class routines like Trim, Integer.parse, <object>.ToString, ....

Maybe you are looking for

  • No sound on my Macbook pro, red light.

    My Macbook Pro won't play anything out loud, through the speakers, like when i have to watch a video or hear some music, i have to put my headphones in the Macbook, and then it can play the sound, but if i take them out, there are no sound and there

  • Convert Real Media files to Apple Tv?

    Anyone know of a good program that will convert Real Media files to an Apple Tv friendly format? Thanks.

  • How to read magnetic stripe cards

    hello everybody, I have asked about magnetic stripe cards regularly. can any one tell me whether the data reading can be done from simple array copy function or we need anything else. does the card listener works for the magnetic stripe in same way .

  • Error creating SQL Command - Database Expert

    I am creating a command however when I go to save the SQL I get two errors. "Failed to retrieve data from database" and "Failed to execute SQL Statement" I am working on an Oracle database.  Why would these errors be occuring?

  • How to have Oracle home 9.2 & 10g on same machine?.....

    Dear All, I have 10g R 2 already installed on my machine. I have installed 9.2 on the same machine... How can I installed What are procedures for setting the path and oracle home.... procedures in doing that.......? thanks in advance KC