We just (finally!) swapped from Rule to Cost-mode. Theres some statements that do daft things that will need tuning but it takes our developers a damn long tmie to change the code as we suggest.

In the short term im going to create stored outlines for bits of code that run worse under CBO when compared to RBO and have tested it and it works;

Alter session user optimizer_mode=rule;
create outline fred for select yada yada from etc;
alter system set use_stored_outlines=true;

Now in another session running CBO, I do the select and the stored outline is used! Fantastic!

Ok, now to the problem....
take a bit of code from oracle Forms -

"Select col
from table
where column1=:my_field_on_screen"

When you look at this in v$SQL for example the code is now apearing as

"Select col from table where column1=:b1"

-ie Oracle tidies up the bind variable names and strips out the cariage returns.

So, bottom line is which of the sql layouts do I use to create the outline?
I have tried
- using the sql that appears in the form - outline never used.
- using the sql that OEM shows - outline never used
- using the sql formatted as it appears in V$SQL - outline not used.

If I run a bit of sql in another sqlplius window, that matches the select I used to create the outline then the outline is used!

Im at a loss - which 'version' of the sql should i use to creae the outline?

-B