local variable/column name conflict?

From: Brenda A Graham <brenda+_at_andrew.cmu.edu>
Date: Wed, 19 May 1999 11:22:32 -0400
Message-ID: <srEhQsm00UiA036F40_at_andrew.cmu.edu>



[Quoted] In PL/SQL, I find that if a table column name and a local variable to which I compare it in a WHERE clause have the same exact name, the value in the local variable is irrelivant, but rather acts like a wild care in the WHERE clause.

TABLE test_table has a COLUMN named code_name that is varchar2(5). Then...

DECLARE
  code_name varchar2(5) := 'ZZZ%';
  kount integer;
BEGIN
  SELECT count(*) into kount
  FROM test_table
[Quoted]   WHERE code_name like code_name;
END; This query selects all rows in the table, reguardless of them matching the value stored in the local variable called code_name. By simply changing the vocal varieble name to be different from the column name, the restriction
works correctly.

Is this a known 'feature' of PL/SQL? Received on Wed May 19 1999 - 17:22:32 CEST

Original text of this message