List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:December 29 2003 7:59pm
Subject:Re: Use of Parameters
View as plain text  
In the last episode (Dec 29), Mario Lucero said:
> I need to use this sentence with parameter but I couln't have which
> is the symbol that is equal to parameter.
> For instance: SELECT * FROM EMPLOYEES WHERE last_name LIKE ? + "%"
> ? means parameter 

Are you sure you want to add two strings together?  That's a math
operation, and you'll just get zero.  You probably want

   WHERE last_name LIKE concat(?, "%")
or WHERE last_name LIKE ?

, and make sure the string you're passing in has a % at the end.

Note that only MySQL 4.1 and above truly support parameters (aka bind
variables); if you're using mysql 3.23 or 4.0, your language's database
API will have to expand them before sending the query to mySQL.

	Dan Nelson
Use of ParametersMario Lucero29 Dec
  • Re: Use of ParametersDan Nelson29 Dec