Topic
  • 4 replies
  • Latest Post - ‏2012-12-19T15:55:15Z by samuelTUIL
QunLily
QunLily
5 Posts

Pinned topic How to fetch a row data with ROWID returned from MON_FORMAT_LOCK_NAME()?

‏2011-05-26T21:56:44Z |
We have figured out a way to get ROWIDs for locked rows. See details in the below thread.

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14621712&#14621712

However, we still do not know how to fetch a row data with ROWID returned from table function MON_FORMAT_LOCK_NAME().

Any advice/suggestion/tip is highly appreciated.

Thanks,
Lily
Updated on 2012-12-19T15:55:15Z at 2012-12-19T15:55:15Z by samuelTUIL
  • QunLily
    QunLily
    5 Posts

    Re: How to fetch a row data with ROWID returned from MON_FORMAT_LOCK_NAME()?

    ‏2011-05-27T16:02:03Z  
    The working syntax to fetch a row data with ROWID value is

    db2 => select * from <tablename> where RID()= <rowid value>
    Hope it helps,
    Lily
  • db2inst1024
    db2inst1024
    41 Posts

    Re: How to fetch a row data with ROWID returned from MON_FORMAT_LOCK_NAME()?

    ‏2011-05-28T09:20:28Z  
    DB2 does not provide interface to operate with row id.
    It provides RID_BIT and RID functions, but it is not what you are looking for.
  • QunLily
    QunLily
    5 Posts

    Re: How to fetch a row data with ROWID returned from MON_FORMAT_LOCK_NAME()?

    ‏2011-05-31T15:46:14Z  
    • QunLily
    • ‏2011-05-27T16:02:03Z
    The working syntax to fetch a row data with ROWID value is

    db2 => select * from <tablename> where RID()= <rowid value>
    Hope it helps,
    Lily
    Correction: The working syntax to fetch a row data with ROWID value is

    db2 => select * from <tablename> where RID()= (<rowid> + <pageid> * 65536)

    Hope it helps,
    Lily
  • samuelTUIL
    samuelTUIL
    2 Posts

    Re: How to fetch a row data with ROWID returned from MON_FORMAT_LOCK_NAME()?

    ‏2012-12-19T15:55:15Z  
    • QunLily
    • ‏2011-05-31T15:46:14Z
    Correction: The working syntax to fetch a row data with ROWID value is

    db2 => select * from <tablename> where RID()= (<rowid> + <pageid> * 65536)

    Hope it helps,
    Lily
    Hello,

    This formula is OK if you are using LARGE tablespace for that table.
    If your tablespace is REGULAR, I think you should used the following formula :

    db2 => select * from <tablename> where RID()= (<rowid> + <pageid> * 256)

    Samuel TUIL
    DBA DB2
    SQL STATE.