The MySQL query should return
1) TRUE along with Comma(,) separated list of STATION_NAME from a table STATION WHERE STATION_NAME is LIKE the INPUT specified buy the user.
FOR Ex:
INPUT = A, OUTPUT= (Agra,Ajmer,Amritsar,Ambala).
INPUT = AM, OUTPUT= (Amritsar, Ambala)
2) FALSE, when no such station exists
3) ERROR.
Detailed PROCEDURE will be appreciated, as I am new to MySQL.
Thanks in advance.. 🙂
You don’t need a procedure, just a select that returns one row on success or no rows on failure:
where ? is a placeholder for the user entered search.
group_concat is a mysql-specific feature.
If you must use a procedure, it would be something like this:
Used like this: