If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Wildcards & Prepared statements

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-25-04, 02:30
trini0 trini0 is offline
Registered User
 
Join Date: Aug 2003
Posts: 24
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
Reply With Quote
  #2 (permalink)  
Old 06-25-04, 03:55
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #3 (permalink)  
Old 06-25-04, 11:41
trini0 trini0 is offline
Registered User
 
Join Date: Aug 2003
Posts: 24
Worked great.
Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On