Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bind Variables / Literals

518643Mar 17 2008 — edited Mar 17 2008
Quick question on something I'm slightly confused over. I know to get the best performance you need to bind so it gets in the shared pool. Does that mean in a pl/sql cursor that you should never have any hardcoded literals, or is it just on key fields that it should never be?

For instance does the 'Y' flag need to be bound using a variable?
cursor c1 is
  select *
    from table
  where pk = p_some_value and
           enabled_flag = 'Y';
select *
  from table
 where pk = p_some_value and
          enabled_flag = p_yes;
That is one thing I've never understood is whether that the Y flag really needs to be bound using a variable, or whether hard-coding it in there is acceptable. Any responses would be appreciated - thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 14 2008
Added on Mar 17 2008
9 comments
787 views