问题
I am a newbee in Apex and I am using apex 5.1.3. I am creating a report through sql query and where clause of the query should be dynamic which needs be taken from another table column. On page load i loaded this where condition string from table and set that as page item :P5_NEW
I tried like this:
select * from EMPLOYEES where :P5_NEW
Page item :P5_NEW contains the string which should be appended to where clause. But apex throws error ORA-00920: invalid relational operator.
Can some one please advice how I can append a string to where clause in APEX report query?
Thanks
回答1:
P5_NEW (well, why not P5_WHERE
?) should be a Text field with "Submit when Enter pressed" set to YES. It should contain the whole WHERE clause, including the WHERE
keyword. If you put it as you did, you'll get the ORA-00936 missing expression error.
Query would then look like this:
select *
from employees
&P5_WHERE. --> pay attention! Ampersand (&) followed by field name
--> followed by a dot (.)
What next? Nothing ... run the page & enjoy. If you enter something like
WHERE department_id = 10
into the P5_WHERE field and hit Enter key, output should change.
来源:https://stackoverflow.com/questions/48308429/how-to-append-a-string-to-where-clause-in-apex-interactive-report-sql