Search This Blog

Monday, April 6, 2015

Query 'like' function with parameter

select UNIQUE FU.USER_NAME,--FL.START_TIME Login_Time,
--limit_time, limit_connects,
 to_char(FIRST_connect, 'DD-MON-RR HH:MI:SS') "Session_Start",
 to_char(last_connect, 'DD-MON-RR HH:MI:SS') "Session_End",
ics.user_id, disabled_flag,
round((last_connect -  first_connect) * 24 * 60) Time_of_session
from icx_sessions ics,fnd_user fu, fnd_logins fl
where last_connect BETWEEN :P_START_DATE AND :P_END_DATE
AND FL.START_TIME BETWEEN :P_START_DATE AND :P_END_DATE
AND UPPER(FU.USER_NAME) LIKE UPPER(:P_USER_NAME)||'%'
 --OR UPPER(FU.USER_NAME) = NVL(:P_USER_NAME, FU.USER_NAME)
and (ICS.USER_ID = :P_USER_ID or :P_USER_ID is null )
and ics.user_id = fu.user_id
and fl.user_ID = FU.USER_ID
ORDER BY USER_NAME

No comments:

Post a Comment