Najla wrote:Always post code using <tt>\
I tried the "select" code but it didn't work too, this is the function I am trying to call
</tt> tags as described in the FAQ.
The function is declared using a quoted identifier. This means that it must always be referenced as a quoted identifier:
create or replace function "Get_CURRENT_USER_DEPT" (F_CURRENT_USER in VARCHAR2) return NUMBER is f_COST_CENTER number; begin select COST_CENTER into f_COST_CENTER from AUTH_USERS where USERNAME=F_CURRENT_USER ; return f_COST_CENTER; end;
Using quoted identifiers in Oracle will only lead to an endless succession of bugs and developer frustration. The solution is very, very simple. NEVER use quoted identifiers in Oracle (except in SQL/XML). There's no good reason to use UPPERCASE in code at all:
create or replace function get_current_user_dept (f_current_user in varchar2) return number is f_cost_center number; begin select cost_center into f_cost_center from auth_users where username = f_current_user; return f_cost_center; end;