In the [Repository|Session] Variable Initialization Block dialog, click Edit Data

18-14 Metadata Repository Builders Guide for Oracle Business Intelligence Enterprise Edition For more information, see Oracle Fusion Middleware System Administrators Guide for Oracle Business Intelligence Enterprise Edition. Example 18–2 A SQL Statement When Site Does Not Use Delivers SELECT username, groupname, dbname, schemaname FROM users WHERE username=:USER AND pwd=:PASSWORD This SQL statement contains two constraints in the WHERE clause: :USER note the colon and the single quotes is the ID the user types when logging in. :PASSWORD note the colon and the single quotes is the password the user enters. This is another system variable whose presence is always assumed when the USER system session variable is used. You do not need to set up the PASSWORD variable, and you can use this variable in a database connection pool to allow passthrough login using the user ID and password of the user. You can also use this variable in a SQL statement. The query returns data only if the user ID and password match values found in the specified table. You should test the SQL statement outside of the Oracle BI Server, substituting valid values for the USER and PASSWORD variables. Example 18–3 A SQL Statement Joining Tables From Multiple Data Sources - When Using the OBI EE Server Setting select WUSER.name, wuser_detail.email from db-11gorcl.NAME.WUSER, sqlexpress.master.dbo.wuser_detail where username=:USER: The above query example in the initialization block uses a join query with multiple tables from different data sources for example, SQLServer, Oracle and XML Files. The query works because when you select the Use OBI EE Server option, the query is rewritten by the BI Server for the specified data sources. Testing Initialization Blocks You should test the SQL statement using the Test button or a SQL tool such as the Oracle BI Client utility. If you use a SQL tool, be sure to use the same DSN or one set up identically to the DSN in the specified connection pool. In online mode, Initialization Block tests do not work with connection pools set to use :USER and :PASSWORD as the user name and password. In offline mode, the Set values for variables dialog is displayed so that you can populate :USER and :PASSWORD. To test initialization blocks optional: 1. In the Administration Tool, select Manage, then select Variables. 2. In the Variable Manager dialog, double-click the initialization block. 3. In the [Repository|Session] Variable Initialization Block dialog, click Edit Data Source . 4. In the [Repository|Session] Variable Initialization Block Data Source dialog, click Test . Note: The Test button is disabled when the Use OBI EE Server option is selected in offline mode. Using Variables in the Oracle BI Repository 18-15 5. In the Set value for the variables dialog, verify the information is correct, and then click OK. 6. In the View Data from Table dialog, type the number of rows and the starting row for your query, and then click Query. The Results dialog lists the variables and their values. The next step is to associate variables with the initialization block. Associating Variables with Initialization Blocks The SQL SELECT statement in the Default initializer list can contain multiple columns. The order of the columns in the SQL statement and order of the variables associated with the initialization block determine the column value that is assigned to each variable. Therefore, when you associate variables with an initialization block, the value returned in the first column is assigned to the first variable in the list. For repository variable initialization blocks, when you open a repository in online mode, the value shown in the Default initialization string field of the Initialization Block dialog is the current value of that variable as known to the Oracle BI Server. The number of associated variables can be different from the number of columns being retrieved. If there are fewer variables than columns, extra column values are ignored. If there are more variables than columns, the additional variables are not refreshed they retain their original values, whatever they may be. Any legal SQL can be executed using an initialization block, including SQL that writes to the database or alters database structures, assuming the database permits the user ID associated with the connection pool to perform these actions. If you stop and restart the Oracle BI Server, the server automatically executes the SQL statement in the repository variable initialization blocks, re-initializing the repository variables. For session variable initialization blocks, you can select Row-wise initialization. The Use caching option is automatically selected when you select the Row-wise initialization option. Selecting the Use caching option directs the Oracle BI Server to store the results of the query in a main memory cache. See About Row-Wise Initialization for more information. The Oracle BI Server uses the cached results for subsequent sessions. This can reduce session startup time. However, the cached results might not contain the most current session variable values. If every new session needs the most current set of session variables and their corresponding values, you should clear this option. See About Using Initialization Blocks with Variables for more information. To associate variables with initialization blocks: 1. In the Administration Tool, select Manage, then select Variables. 2. In the Variable Manager dialog, double-click the initialization block you want to edit. You can edit repository initialization blocks, or session initialization blocks.

3. Click Edit Data Target.