When local variable in package and column name table are the same name, the column names take precedence.
create table test(a int);
insert into test values(1);
CREATE OR REPLACE function GET_AVG_PRICE()
RETURN text IS
a int;
BEGIN
select a /*column*/ into a /*package variable */
from test limit 1;
dbms_output.put_line(a);
return a || '';
END GET_AVG_PRICE;
/
When local variable in package and table name are the same name, the table names take precedence.
create table tn (id int); create package tn IS id text; end; / CREATE OR REPLACE function abc() RETURN text IS a tn.id%type; -- int v text; BEGIN select pg_typeof(a) into v ; dbms_output.put_line(v); return v; END abc; /
In addition, package name and schema name are not allowed to be duplicated, so there is no conflict.