Results 1 to 4 of 4
  1. #1
    Join Date
    May 2015
    Location
    Korea
    Posts
    61
    Provided Answers: 1

    Unanswered: What is equavanet of ROWID of Oracle in DB2 LUW?

    For example :
    db2 "create table test (c1 varchar(7))"
    db2 "insert into test values ('test0')"

    Which is correct equivalent of ROWID (Oracle) in linux db2 v11.1fp1?

    db2 "select RID(test) from test"
    db2 "select RID_BIT(test) from test"

  2. #2
    Join Date
    Apr 2012
    Posts
    1,143
    Provided Answers: 27
    If your DB2 database was created after DB2_COMPATIBILITY_VECTOR=ORA db2 registry variable had already been defined, then you can use RID() and RID_BIT() as is.
    Example:

    Code:
    create table test (c1 varchar(7))
    DB20000I  The SQL command completed successfully.
    
    insert into test values ('test0')
    DB20000I  The SQL command completed successfully.
    
    select RID(test) from test 
    
    1                   
    --------------------
                       4
    
      1 record(s) selected.
    
    
    select RID_BIT(test) from test 
    
    1                                  
    -----------------------------------
    x'04000000000000000000262605000000'
    
      1 record(s) selected.
    $

    You can also use these functions even if the database was not created while that variable was set.

  3. #3
    Join Date
    May 2015
    Location
    Korea
    Posts
    61
    Provided Answers: 1
    Thanks: )

    I'm wondering which one out of these two [ RID(test) or RID_BIT(test) ] is the most accurate equivalent of ROWID in Oracle?

  4. #4
    Join Date
    Apr 2012
    Posts
    1,143
    Provided Answers: 27
    What do you mean "most accurate" ? Each function yields a value that uniquely identifies a row (either Bigint or V(16)FOR BIT DATA ), and that value can change after a reorg.

Posting Permissions

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