Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2007

    Unanswered: Escape delimiter in select query

    Hi All,
    Need your help on this query... The query is as follows :

    select nm_ctrl_cd from temp where locate('*',translate( nm_ctrl_cd , '*******************************', '~!@#$%^&*()_+}{":?><`-=]['' /., ;' )) > 0

    When i execute this query , i am getting the following error:

    "SQL0010N The string constant beginning with "' )) > 0
    " does not
    have an ending string delimiter."

    Now this is certainly bcoz of the delimiter.. So the point is that i need to know how to escape a delimiter..

    Please help me out with this as i need to fix an issue.


  2. #2
    Join Date
    May 2003
    Use two consecutive single quotes to replace one single quote.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Apr 2007
    You didn't specify which version you're using, so I don't know if you're using ASCII or EBCDIC. What you can do is concat the ';' character as a hex string. I think I have the right value for ASCII in this example:

    select col1 from tbl1
    where locate('*',translate( col1 
    , '*******************************'
    , '~!@#$%^&*()_+}{":?><`-=]['' /., ' || x'59' )) > 0;

Posting Permissions

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