EDIT: The question is how to query all row with input stringarray variable, NOT how to delarce/assign stringarray variable.
I'm newbie oracle user.
Table_example
| ID | Name |
|---|---|
| 1 | A |
| 2 | B |
| 3 | C |
| 4 | D |
- Query
select * from Table_example
where id in ($var);
$var = '1','2' => query 2 rows.
$var = ...? => list all row. ($var input from textbox, please don't suggest $var = select id from Table_example)
- I tried:
select * from Table_example
where (
id in ($var)
or
$var = 'all'
);
$var = 'all' => list all row OK
$var = '1','2' => got ORA-00920 error, cannot query.
Please help me how to bypass stringarray variable to list all row, or how to check if stringarray variable ($var) is null or $var = 'all'. (please don't use function or procedure, just query).
Thanks and best regard.
Loc Nguyen.