Results 1 to 2 of 2

Thread: SQL where clause reference modification

  1. #1
    Join Date
    Dec 2008
    Posts
    1

    Thumbs down SQL where clause reference modification

    Hi Friends,

    I came across a situation where I need to use reference modification in WHERE caluse of SQL query. But it is throwing me error syaing : is invalid symbol.

    SELECT * FROM DMG.CLAIMS_USPS_TRANS
    WHERE BUSINESS_KEY(1:10) = '0050075135';

    In above query, BUSINESS_KEY is 30 chars length in which first 10 chars are CLAIM_NUM. But this kind of reference modification is not working. Could you please suggest how I can write in this case?

    Regards,
    Sudhakar.

  2. #2
    Join Date
    Apr 2009
    Posts
    86
    Sudhakar, try:

    SELECT * FROM DMG.CLAIMS_USPS_TRANS
    WHERE BUSINESS_KEY liKE '0050075135%';

    or

    SELECT * FROM DMG.CLAIMS_USPS_TRANS
    WHERE substr(BUSINESS_KEY,1,10) = '0050075135';

    The LIKE is more efficient if BUSINESS_KEY is Indexed.

Posting Permissions

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