Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2002
    Posts
    17

    Unanswered: Using the sequence of db2 from db1 for inserting a record

    From db1 ...I am trying to insert into db2...All the columns inserting correctly ...except the field with sequence value...

    I have a sequence created in db2 named 'seq_request'.

    I am not able to use the sequence of db2('seq_request')...Pls see the below insert statement
    Is there any specfic way to use the sequence...do i have to give the db link name also..


    "INSERT INTO TESTUSER.AUDIT123@MAINLINK(AUDITFIELD2,AUDITFIELD1 ,SEQ_REQUEST) VALUES ("test1","test2",SEQ_REQUEST.NEXTVAL)";

  2. #2
    Join Date
    Jul 2001
    Location
    Germany
    Posts
    189
    Hello,

    there many ways to use the sequenz object of a remote database.

    1) Use the link directly in the insert statement - as you already mentioned

    2) Use a stored function with a pragma statement to do that for you

    3) Use a public synonym with a dblink

    Hope this help.

    Manfred Peter
    Alligator Company
    http://www.alligatorsql.com

    * did you ever use multiple RDBMS with one tool - try AlligatorSQL *

  3. #3
    Join Date
    Feb 2002
    Posts
    17

    IT IS WORKING FINE NOW

    I tried as below and it is working fine Now..


    Thanks for the Inputs....

    INSERT INTO TESTUSER. AUDIT123@MAINLINK(AUDITFIELD2,AUDITFIELD1,SEQ_REQU EST)
    VALUES ('t1','t2',testuser.seq_request.nextval@mainlink)




  4. #4
    Join Date
    Mar 2012
    Posts
    1

    inserting value in db2 table using oracle sequence by creating dblink

    Hi sethu,

    Can you plz explain which databases you are using? is db1 also DB2 database?

    i have created db link between oracle and DB2. i am able to fetch/insert data into DB2 from oracle. however i want to use oracle sequence to insert data in db2 table in one of the column. but it is giving error "ORA-02070: database TEMPDB does not support sequence references in this context".


    Can anyone help on this?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •