DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Wrong Query Results

  1. #1
    Join Date
    Sep 2000
    Posts
    128
    ok, I know it's monday, but I'm sure I'm awake...!

    Just wondered why I'm getting this result:

    1 select table_name, cache from dba_tables
    2* where cache != 'N'
    SQL> /

    TABLE_NAME CACHE
    ------------------------------ -----
    CDEF$ N
    TAB$ N
    IND$ N
    CLU$ N
    USER$ N

    etc. for all tables.

    but:

    1 select table_name, cache from dba_tables
    2* where cache = 'N'
    SQL> /

    no rows selected

    I have no tables cached - I know that, so I guess I must've made the most basic error in my query?!

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Seems like the cache column has has padded values:

    select table_name, cache from dba_tables
    where rtrim(ltrim(cache)) != 'N'

    I found this by:
    select table_name, '|' || cache || '|' cache
    from dba_tables
    where rtrim(ltrim(cache)) != 'N'

    Jeff Hunter

  3. #3
    Join Date
    Apr 2000
    Location
    roma
    Posts
    131
    take a look at dba_tables, for cache:
    cache varchar2(5)
    -----
    N

    is the last value, so you have to put '%N'

  4. #4
    Join Date
    Sep 2000
    Posts
    128

    Smile AH HA!

    Thanks,

    knew there'd been a simple explanation - For some reason I was convinced that I'd run the same query last week with 'N' - but guess I obviously didn't!

    Terry.

  5. #5
    Join Date
    Oct 2000
    Location
    Cambridge, MA (Boston)
    Posts
    144
    whenever i get a result that makes me think i'm losing my mind, i concatenate some beginning and ending characters. it has helped me out many a time.

    select table_name, '[' || cache || ']' from dba_tables ;

    D.

Posting Permissions

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


Click Here to Expand Forum to Full Width