Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> local variable/column name conflict?
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
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 - 10:22:32 CDT