Oracle Applications

Oracle for Beginners

Function to fetch User Details

Posted by shameemakhtar on June 29, 2010

create or replace function ztd_get_user_fn
p_user_id in varchar2
return varchar2
p_user_name varchar2(100);
select user_name
into p_user_name
from fnd_user
where user_id = p_user_id;
return p_user_name;

when others then
return nvl(sqlerrm, null);


This function will return the username when you pass in the user_id. In case no data is found or any other error is encountered, you will receive the appropriate error code.

Tables used:

You can use the following select statement to test your function:

select ztd_get_user_fn(14061)
from dual;

Shameem Bauccha
28 June 2010


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s