The intention of this blog is to share findings about Oracle applications like Oracle Business Intelligence (OBIEE, OBIA) or Fusion middle ware Applications (OBIEE 11g) from technical and other (sometimes unprecedented) perspectives.
Sunday, 11 November 2012
Thursday, 25 October 2012
How to split comma (,) separated string and pass to IN clause of select statement
In some cases, we get a comma separated string as output (say from another select statement) that we would need to pass to the IN clause of a select statement.
This article explains how to achieve that using regexp_substr (DB >=10g).
For example, assume a select statement returns the following
'ALLAM,NARASIMHA,JONES,SMITH'
Now, we would need to pass this to another select statement as IN clause and get the output.
SQL> Select * From EMP where ENAME in ('ALLAM,NARASIMHA,JONES,SMITH' );
no rows selected
this is not our expected output. We expect the query to return 4 rows. This can be achieved by splitting the comma separated string to individual strings and pass it to the IN clause.
Oracle provides regexp_substr() function, which comes handy for this scenario.
First, we will form a query, that splits this comma separated string and gives the individual strings as rows.
SQL> select regexp_substr('ALLAM,NARASIMHA,JONES,SMITH' ,'[^,]+', 1, level) from dual
connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null;
The above query iterates through the comma separated string, searches for the comma (,) and then splits the string by treating the comma as delimiter. It returns the string as a row, whenever it hits a delimiter.
We can pass this query to our select statement to get the desired output.
SQL> Select ENAME,EMPNO,ESAL
From EMP
Where ENAME in (
Select regexp_substr('ALLAM,X,Y,Z,K,N' ,'[^,]+', 1, level) as Names from dual
connect by regexp_substr('ALLAM,X,Y,Z,K,N', '[^,]+', 1, level) is not null );
This article explains how to achieve that using regexp_substr (DB >=10g).
For example, assume a select statement returns the following
'ALLAM,NARASIMHA,JONES,SMITH'
Now, we would need to pass this to another select statement as IN clause and get the output.
SQL> Select * From EMP where ENAME in ('ALLAM,NARASIMHA,JONES,SMITH' );
no rows selected
this is not our expected output. We expect the query to return 4 rows. This can be achieved by splitting the comma separated string to individual strings and pass it to the IN clause.
Oracle provides regexp_substr() function, which comes handy for this scenario.
First, we will form a query, that splits this comma separated string and gives the individual strings as rows.
SQL> select regexp_substr('ALLAM,NARASIMHA,JONES,SMITH' ,'[^,]+', 1, level) from dual
connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null;
The above query iterates through the comma separated string, searches for the comma (,) and then splits the string by treating the comma as delimiter. It returns the string as a row, whenever it hits a delimiter.
We can pass this query to our select statement to get the desired output.
SQL> Select ENAME,EMPNO,ESAL
From EMP
Where ENAME in (
Select regexp_substr('ALLAM,X,Y,Z,K,N' ,'[^,]+', 1, level) as Names from dual
connect by regexp_substr('ALLAM,X,Y,Z,K,N', '[^,]+', 1, level) is not null );
Now, the query returns what we expected.
Thursday, 27 September 2012
Protect Filter in OBIEE
The feature was already there from OBIEE 10g versions. We need to take some extra precautions before applying this in request filters which can be adopted as best practice in report development.
This ensures that the filter used in the request is not lost or overwritten by another filter or dashboard prompt that may supersede the request.
This option is only available if a value has been specified in the filter. If the filter item is set to “is prompted” then the Protect Filter option if not available.
And The filter is looks like the this. With the "key" icon on the filter icon to lock the values to restrict the change.
This option is only available if a value has been specified in the filter. If the filter item is set to “is prompted” then the Protect Filter option if not available.
Select Filter Options button> Check the Protect Filter option as seen in the screen below...
Wednesday, 26 September 2012
Upgrade OBIEE 10g RPD and web catalog to OBIEE 11g
Before running Upgrade Assistant
configures TNSNAMES.ora in your 11g system so that it connects to any databases
used by the RPD.
In addition, any custom changes to
the Oracle BI EE 10g configuration files, for example, instanceconfig.xml, are not upgraded by Upgrade Assistant. You must manually
edit the 11g configuration files to re-apply the customizations.
The following configuration changes
may be necessary before running Upgrade Assistant:
- Confirm any data sources used by your RPD are configured in the 11g system.
- If you configured the nqsconfig.ini file in the 10g system for database authentication, you must copy over the same configurations to the 11g version of the files.
For
example, to add the following parameter in the nqsconfig.ini
file for this type of authentication:
SECURITY
AUTHENTICATION_TYPE
= DATABASE;
DATABASE
DATABASE
= "orcl";
Note: The Admin Server and the Managed Server
must be running during the upgrade process.
OBIEE 11g upgrade assistant is
installed by default and is located under Oracle fusion middleware home
$ORACLE_FMW/bin.
Pre-Requisites:
- Start up all the OBIEE 11g related services (BI Services and Web logic Server) and check that you can log in to Enterprise Manager,WLS Admin Console and OBIEE Answers.
Enterprise Manager :
http://localhost:7001/em
Web Logic Server Admin Console: http://localhost:7001/em console
OBIEE Answers/Dashboard : http://localhost:9704/analytics
Web Logic Server Admin Console: http://localhost:7001/em console
OBIEE Answers/Dashboard : http://localhost:9704/analytics
- All the relevant TNS names used
in the 10g rpd connections are present in
/Oracle_BI1/network/admin/tnsnames.ora file
Step-1
In Windows:
Navigate
to /Oracle_BI1/bin/ua.bat . This batch file is the Upgrade
Assistant wizard. Launch the wizard by double clicking on it.
In
UNIX:
/app/oracle/product/Oracle_BI1/bin
[oracle@linux-db102 bin]$ ls -ltr ua
-rwxr-x— 1 oracle oinstall 12640 Jun 1 2010
ua
To launch the Upgrade Assistant GUI,
just run the command ua
- Step-2:
Specify the location of the 10g RPD file.
Enter the Administrator credentials of the old 10g RPD file.
Specify the password for the upgraded 11g RPD and confirm it once again.
- Step-4: Specify the Weblogic Admin Console username and password. Port number is 7001
Click Next
During the examination process, Upgrade Assistant checks
for the following:
• The source directory exists.
• The source directory is readable and contains a file for upgrade.
Under the Status column, the word succeeded should appear. If instead, the word failed appears, inspect the log file for details.
• The source directory exists.
• The source directory is readable and contains a file for upgrade.
Under the Status column, the word succeeded should appear. If instead, the word failed appears, inspect the log file for details.
- Step-6: Once the upgrade process completes the process log output is available at
\Oracle_BI1\upgrade\logs.
The new RPD will be created as sh.rpd and
Placed at the following path:
As part of upgrade, security is also upgraded from 10g to 11g. This includes the Users and Groups.
Manual customizations to files like instanceconfig.xml are not upgraded and must be redone after upgrade.
We can use this Oracle Link for any clarification:
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi11115/upgrade/upgrade_to_11g.htm
Subscribe to:
Posts (Atom)