Question

I have found a syntax for writing a conditional SQL statement in Datasets of Oracle BI Publisher 10G. For example, I want the data to be either in full details or distinguished depending on a parameter I've defined.

To illustrate what I want:

There will be a parameter, for example P_UNIQUE, which is a list of choices that the user can select from, the list holds these values

Data is unique, Value = 1

Data is not unique, Value = 2

Then based on the user selection, the executed SQL command in the dataset at run time will be either:

SELECT 

        DISTINCT 

        FIRSTNAME || ' ' || LASTNAME AS EMP_NAME, 
        DECODE(TRANSACTIONTYPE, 19, 'SUCCESS', 'FAILURE') AS ACCESS_ATTEMPT, 
        READERDESCRIPTION AS DOOR,

        etc…

Or

   SELECT 

        FIRSTNAME || ' ' || LASTNAME AS EMP_NAME, 
        DECODE(TRANSACTIONTYPE, 19, 'SUCCESS', 'FAILURE') AS ACCESS_ATTEMPT, 
        READERDESCRIPTION AS DOOR,

        etc…

(Notice the Distinct keyword in the previous code snippet)

Of course, this is not possible in SQL, but I came across this amazing feature in BI 10G to achieve that, see code below:

SELECT 
    
    {$ if ${P_UNIQUE}='1' $}
    DISTINCT 
    {$endif$}
    /*no need for else, the distinct keyword will simply not be presented if the p_unique parameter value is not equal to 1*/
    
    FIRSTNAME || ' ' || LASTNAME AS EMP_NAME, 
    DECODE(TRANSACTIONTYPE, 19, 'SUCCESS', 'FAILURE') AS ACCESS_ATTEMPT, 
    READERDESCRIPTION AS DOOR,

        etc…

This is working perfectly in 10G

Now the problem I faced is that, we migrated to 11G, all reports from 10G are now working normally and as expected in 11G, but you can't write this code from scratch, it is not recognized at development time in 11G, and you will not be able to save your query if it contains an error, although it is working in the migrated reports.

And also, I can't edit and save my edits in those migrated reports for the same reason.

So, how to overcome this development-time limitation and to be able to save the query regardless of what is written inside it?

As I stated before, it is working in 11G, but I cant edit existing or create new one with these special commands.

So, any suggestions will be appreciated.

Was it helpful?

Solution 2

This issue is now fixed in the latest Oracle 11g patch

11g Release 1 (11.1.1)

It was in the prior version.

A drop-down box have been added to allow the developer to select the query type Type of SQL, the best fit for this type queries is Non-Standard SQL

Just tested it, it is working fine

OTHER TIPS

Try the concept of flexfields, it is newly introduced to BI 11g

Link to oracle help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top