I have a database that is suppose to be a mock of a database a library would use. I am now writing a c program that would be the interface for the librarians and users of the library. One of the menu options I have is an option to search for a book by its title. For instance, one of the books in the library is "The Humane Interface". If the user searched for "Humane", they should get that as a result. If the user searched for "Hum", they should get that result.
My table that holds the titles of my books is called BOOK. Here is my select statement.
WHERE TITLE LIKE '%:title%';
:title is the value I get from the user. It seems to be searching for ":title" instead of what :title is a variable for. I also tried to use strcat like so:
WHERE TITLE LIKE :temp;
The SELECT statement works because if I hardcode "Humane" into the select, it returns the book. I just need to know how to pass the variable into the SELECT statement. I am not sure if there is a problem with newlines at the end of the string or not.
The database I am interacting with is an Oracle9i and I am using sqlplus.
Hope this is enough information.