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
is
p_user_name varchar2(100);
begin
select user_name
into p_user_name
from fnd_user
where user_id = p_user_id;
return p_user_name;

exception
when others then
return nvl(sqlerrm, null);
end;

commit;

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:
fnd_user

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

select ztd_get_user_fn(14061)
from dual;

Shameem Bauccha
28 June 2010

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s