Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2012
    Posts
    2

    Question Unanswered: Direct Record access using ROWID

    I have executed a query in db2 on my table as and ROWID are not the part of attribute of table they are generated internally by DB2.

    select ROWID as Rid, "CUSTOMERID", "FIRSTNAME" from MYDWTABLE;

    results are
    Rid CUSTOMERID FIRSTNAME
    0200a0030000000000004f320a000000 11004 Elizabeth

    but if i want to access record directly using query as

    select "CUSTOMERID", "FIRSTNAME" from MYDWTABLE
    where ROWID='0200a0030000000000004f320a000000';

    no records are in results

    But in Mysql I have use these queries well

    help me

  2. #2
    Join Date
    Jun 2007
    Location
    germany
    Posts
    155
    well, in db2 you will never have a record returned, regardless of the SQL.
    you can only have row(s) returned.

    as far as rowid access,
    here are a few links that you should read which will guide you on your way:
    2.6.1 Using ROWID columns as keys
    2.6.1.2 Direct row access
    6.4.2.5 Is direct row access possible? (PRIMARY_ACCESSTYPE = D)
    Dick Brenholtz, Ami in Deutschland

  3. #3
    Join Date
    Jun 2007
    Location
    germany
    Posts
    155
    and if i was to venture a guess,
    the ROWID should be represented as a hexadecimal literal rather than char.
    Dick Brenholtz, Ami in Deutschland

  4. #4
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by techteachermayank View Post
    select "CUSTOMERID", "FIRSTNAME" from MYDWTABLE
    where ROWID='0200a0030000000000004f320a000000';
    What about:
    Code:
    select CUSTOMERID, FIRSTNAME  from MYDWTABLE 
    where ROWID=x'0200a0030000000000004f320a000000';
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  5. #5
    Join Date
    Sep 2012
    Posts
    2

    Question Not working and problem not solved

    Quote Originally Posted by Peter.Vanroose View Post
    What about:
    Code:
    select CUSTOMERID, FIRSTNAME  from MYDWTABLE 
    where ROWID=x'0200a0030000000000004f320a000000';
    I am using Windows 7 and IBM Data studio 1.3.3
    But
    how this query works

    select "CUSTOMERID", "FIRSTNAME" from MYDWTABLE
    where ROWID=(select ROWID from MYDWTABLE where CUSTOMERID=11004);

    This query is working fine

Tags for this Thread

Posting Permissions

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