Skip to Content
author's profile photo
Former Member

Determining Database Record No.

hi, how would i know what is database record no. of a given table record. i'll be using this record no. as part of a computed data w/c should be unique per given record.

thank you very much,

rico

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Posted on Aug 17, 2004 at 04:52 AM

    Hi Rico,

    The below statement will get unique number of record count from DB.

    SELECT COUNT( DISTINCT <field> ) INTO wf_count FROM <table name>.

    Regards,

    Prabhu Rajesh.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 17, 2004 at 06:27 AM

    I think there is nothing like you need, except the primary key of the tables. If you can access your DB server, it will provide you with the unique row id (if I could remember, Oracle uses ROWID). I did not worked with DBs in a long time, but I think the ROWID is not a solution...

    Why you don't use yout table PK? I think you can use an itab like:

    DATA: BEGIN OF itab OCCURS 0,

    myownpk TYPE STRING.

    INCLUDE STRUCTURE dbtable.

    DATA: END OF itab.

    After retrieving the data, or in your own loop, assing a concatenate of the PK fields to your myownpk field of itab, and you will have a single id of every record.

    I think is not a clean method, still thinking that you must use your table's PK.

    I wish someone with better knowledge than me will provide you with a better solution. Good luck,

    Vic

    Add comment
    10|10000 characters needed characters exceeded