pl/sql forcing RHS of = in where clause to be variable?

From: <mh_at_pixar.com>
Date: Tue, 01 Jul 2008 20:59:38 GMT
Message-ID: <_Uwak.431$vn7.350@flpi147.ffdc.sbc.com>


This code will compare a column to a variable:

declare myx number;
begin
  select * from foo where x=myx;
end;

but suppose I have a variable with the same name as a column:

declare x number;
begin
  select * from foo where x=x;
end;

This will compare column x with column x, and not with the variable x, right? Is there syntax to force the rightmost x to be a variable? Or should I do

  myx := x;
  select * from foo where x=myx;

This is in the context of a parameter name of a public function, so I don't want to do the obvious choice of renaming the variable.

Many TIA!
Mark

-- 
Mark Harrison
Pixar Animation Studios
Received on Tue Jul 01 2008 - 15:59:38 CDT

Original text of this message