Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Seek command cannot find the exact string

  1. #1

    Seek command cannot find the exact string

    hi,

    I used the seek command to locate a transaction string on the index file.

    SEEK 'MC-15/9022-001E'
    IF FOUND()
    ...
    ENDIF

    But the program returns a wrong transaction code which is 'MC-15/9012-001E'. Any idea what's wrong?

    thanks a lot.

  2. #2
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Hi,
    I would say the index file is outdated or somehow wrong.
    Make the new one.

    If it continues, try to get the same behaviour with Southwind database, to be sure.

    Not finding the solution, let you then make the app package with some simulation table
    and your behaviour, so other guys can explore your problem.

    Josip

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,161
    Blog Entries
    22
    I would guess you have trim() in the index,the key you are looking up is not the exact length or you have SOFFSEEK ON. If you ever need help you need to provide details of the index key expression and the key being looked up.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #4
    Hi Abdul,

    I created a table with your values and got the same thing you did.

    Try this.

    select <table>
    set exact on
    SEEK 'MC-15/9022-001E'

    That is working for me.

    Herb

  5. #5
    Thanks a lot guys for your help.

    Everything is fixed now.

    mojeb

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,161
    Blog Entries
    22
    I'm not seeing any behavior like that at all. It all works as I expect it too.

    See screenshot below.

    Name:  Screen Shot 2015-12-22 at 10.35.54 AM.jpg
Views: 82
Size:  63.7 KB
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  7. #7
    hi barry,

    The problem is fixed by re-indexing the table but later I encounter this error message

    to atrno
    ^
    Fatal I/O error reading index file - errno 22 (op=Index Read file=ATRNO at 30303000, size=1396060212)

    what does this error mean? But I believe it has something to do with the index file right?

    thanks
    Last edited by abdulmojeb; 2015-12-21 at 21:54.

  8. #8
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,161
    Blog Entries
    22
    If you let me see the index expression as I asked earlier I can better tell you. You should not be using any trim functions in indexes. The index keys need to all be the same length.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,161
    Blog Entries
    22
    The 303030 is hexadecimal for 000 so my suspicions are that you have indexed using a TRIM function.

    With SET STRCOMPARE ON (which is the default) all index operations, SQL optimizations and string comparisons are automatically trimmed and compared case insensitive.

    For example:

    m_searchvalue = "ALFKI"
    select * from customers where trim(upper(customerid))=trim(upper("&m_searchvalue "))

    with STRCOMPARE ON is just:

    m_searchvalue = "ALFKI"
    select * from customers where customerid="&m_searchvalue"

    This saves a lot of messy coding.

    If if you don't want this behavior turn it off.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  10. #10
    I tried that before but it cannot find some records because of extra space on the expression. Please look at this

    create index plate on artrans (atplate,atcd)
    explain select * from artrans where atplate='RNW340' and atcd='S'

    the field ATPLATE has maximum of 7 characters length. The output is

    Optimized WHERE condition for table 'artrans' using index tag 'PLATE'
    Table 'artrans' has 146127 records
    SEEK 'RNW340 S'
    SCAN WHILE ATPLATE+ATCD = 'RNW340 S'
    Total I/O read operations was 4
    3 records selected in 2ms

    3 records are selected using the sql select but using the scan command no record is selected

    SEEK 'RNW340S'
    SCAN REST WHILE atplate+atcd = 'RNW340S'

    ENDSCAN

    thanks

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us