ORA-00904 Invalid Identifier help needed
586609Nov 2 2009 — edited Nov 3 2009I have a simple function that I have pared down to a minimal form needed to reproduce the error. Previously there were more joins, a WHERE clause referencing the input parameter, and a bunch of UNION ALL clauses before the closing parenthesis. The error message doesn't specify which identifier it doesn't like, so I have very little to go on.
CREATE OR REPLACE FUNCTION get_addrinfo1(i_usr_id IN NUMBER)
RETURN VARCHAR2 IS
l_add_type VARCHAR2(2000);
BEGIN
SELECT add_type
INTO l_add_type
FROM (SELECT 'H' AS add_type
FROM t_usr_cnctinfo
JOIN t_usr_add ON t_usr_cnctinfo.ucti_hom_add = t_usr_add.uadd_id
WHERE ROWNUM = 1);
RETURN l_add_type;
END get_addrinfo1;
/
If I comment out the JOIN, the error goes away. If I copy the entire SELECT out of the function, remove the INTO line and run it as a query, it returns an 'H' as expected with no error. The tables exist and the columns referenced exist in the appropriate tables. Does anyone see what the problem could be?