How to append a string to where clause in APEX Interactive Report SQL

回眸只為那壹抹淺笑 提交于 2019-12-23 02:40:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!