Hi there,
I just got the same requirement and got a question about it...
Since dynamic SQL should be avoided, I would like to solve this using a if statement.
What I got looks like this:
IF lv_name IS NULL THEN | ||
result = SELECT * FROM CUSTOMER; | ||
ELSE | ||
result = SELECT * FROM CUSTOMER WHERE C_NAME = :lv_name; | ||
END IF; |
The problem is I can't iterate over the result table since it is not a cursor.
Question: How to change result into a cursor?
According to this document on page 26 something like this should work:
CURSOR result FOR SELECT * FROM CUSTOMER WHERE C_NAME = :lv_name;
but that gives me a syntax error.
Any ideas?
Thanks!