Search code examples
user-inputsql-like

Search through a table with user input


This is my script:

select * from cliente 
where NOME_CLIENTE like (Upper('&supplier_name') || '%');

and it all gives me "no rows selected". Why does this happen? And how to fix it?


Solution

  • According to the description, you need to have the wildcard '%' before the user input as well, here is the example:

    select * from cliente 
    where NOME_CLIENTE like ('%' || upper('&supplier_name') || '%');