Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    24

    Unanswered: Wildcards & Prepared statements

    Im currently working with db2 8.1.3 on w2k and php.
    With using a [select ... like %?%] statement, it chokes with an error about illegal syntax.
    --
    Warning: [42601][-7][IBM][CLI Driver][DB2/NT] SQL0007N The character "%" following "lags where name like" is not valid. SQLSTATE=42601 in c:\inetpub...
    --
    And when I quote the wildcards/placeholder '%?%', the php extention gives me an error.
    So Im looking to see what is the correct way, of how db2 should accept a
    prepared statement with wildcards, so I can arm myself with information to take to the php extention author.

    Im guessing (as far as db2 is concerned) it should be ->
    select from nullid.flags where name like '%?%'

    Thanks

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    You need to embed the wildcards (%) in the substitution variable (or host variable if applicable) at runtime if you are using parameter markers or (host variables).
    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
    Aug 2003
    Posts
    24
    Worked great.
    Thanks

Posting Permissions

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