Understanding Siebel SQL Spool

You can spool the SQL to a file using dedicated client by including the /s switch in your dedicated client link. However, I advise that it is better to just view the siebel dedicated client log file as the siebel log file will contain not only the SQL spool but also the Event Context and other useful information as to what Siebel is doing. You need to ensure that the SIEBEL_LOG_EVENTS environment variable is set to 4 on your local machine to get this information.

In the Siebel log file, the following text will precede the SQL spool associated with a business component:

Begin: Execute SqlObj ‘[bc_name]’

Where [bc_name] = The name of the business component

There can exist multiple SQL statements associated with instantiating a business component. The first SQL statement is the main core SQL query to instantiate the business component. Then any additional SQL statements exist associated to multi value links that have not got the Use Primary Join set. Also additional SQL statements are generated through calculated fields that perform counts on multi value fields.

The main SQL statement is generated based on the configuration of the business component as such:

1. The primary table of the business component will be listed last in the FROM clause. For example, the Action business component would have the S_EVT_ACT table as the last table in the FROM clause.

2. Any fields exposed through the UI will be included in the SQL. If the field is a join, then the join will automatically be included in the SQL. If the field is a MVF where the MVL uses primary join then the join will be included in the SQL.

3. Any fields that have Force Active = Y, Immediate Post Changes = Y or Link Specification = Y or Required = Y will be included in the SQL even if these fields are not rendered through the UI.

4. Any calculated fields that use InvokeServiceMethod to invoke a business service would result in additional SQL statements for any queries that are performed within the business service called.

5. The search specification of the business component will be incorporated into the WHERE clause of the SQL statement. If the user performs a a query through the UI then this would be applied to the SQL WHERE clause also.

6. The sort specification of the business component will be included in the SQL in the ORDER BY clause.

7. The business component view mode will be incorporated into the SQL depending on the view mode applied.

8. Siebel Tools does not always show all joins used by a business component – these are vanilla joins. For example the Contact BC, when the SQL is spooled this shows joins to S_CONTACT_SS and S_CONTACT_BU which are not configured in Siebel Tools but exist by default associated to the Contact BC.

9. For any joins configured in Siebel Tools, if the Outer Join Flag = Y then the join will be shown in the SQL spool as an outer join. The join will be shown as an inner join if the Outer Join Flag != Y.

1 thought on “Understanding Siebel SQL Spool

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s