'User Input in Oracle Application Express online

On the Oracle Application express online, I want to be able to read input from the user.

I want to write a SQL statement to display all employees with first names starting with the letter that the user inputs. I thought we write

SELECT * FROM employees
WHERE first_name LIKE '&letter%';

But this doesn't work. It displays "no data found".

I also tried doing this , but it is still wrong. This one gives an error message "ORA-00911: invalid character" after I enter any letter.

SELECT * FROM employees
WHERE first_name LIKE :letter%;

I am just a beginner and when I searched , I didn't understand what my mistake is. I would really appreciate your help.



Solution 1:[1]

I know it's a bit too late but I've been encountering the same problem recently and i just found out that instead of using the & try : like the following, it should work nicely!

SELECT * FROM employees
WHERE first_name LIKE ':letter%';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Csala