I have an APEX 20.2 page region based on selecting rows from a table. This works fine, but if I want an administrator to see all records, I would have thought I could add the line:
OR apex_acl.has_user_role(:APP_ID, :APP_USER, ‘ADMINISTRATOR’)
An example would be:
select ALBUM_TITLE, YEAR_OF_RELEASE, ALBUM_ID, ARTIST_ID, ALBUM_TYPE_ID, COMMENTS, COVER_ART_BLOB_CONTENT, COVER_ART_MIME_TYPE from MUSIC_ALBUMS where 0=1 OR apex_acl.has_user_role(:APP_ID, :APP_USER, 'ADMINISTRATOR')
But when I do this, the query returns the error
What am I doing wrong?
Some inbuilt packaged functions do not work with SQL queries. You can create a function and can use it in your query. Below is an example:
Then use the above function in your query:
That has worked. Thanks.