In a situation where a table column name and a function name are one and the same, and we require to call the function into a sql which is also selecting from the said table ,then to call the function we need to qualify it with the schema name. The illustration below makes this amply clear.
SQL> CREATE TABLE TEST ( X VARCHAR2(100));
Table created.
SQL> INSERT INTO TEST VALUES ('SQL CALLS
TABLE COLUMN');
1 row
created.
SQL> ED
Wrote file afiedt.buf
1
CREATE OR REPLACE FUNCTION X
2
RETURN NUMBER
3
AS
4
LV_RETURN NUMBER;
5
BEGIN
6
LV_RETURN:=1;
7
RETURN LV_RETURN;
8* END;
SQL> /
Function created.
SQL> COMMIT;
Commit complete.
SQL> SELECT X
FROM TEST;
X
--------------------------------------------------------------------------------
SQL CALLS TABLE COLUMN
SQL> SELECT PMEKALA.X
FROM TEST;
X
----------
1