The following lines contain the word 'select', 'insert', 'update' or 'delete':
--machine/port, In this case it should not delete previous login record
UPDATE MTL_MOBILE_LOGIN_HIST
SET LOGOFF_DATE = logon_date,
event_message = 'MWA SERVER EXCEPTION'
WHERE
USER_ID = p_user_id
AND SERVER_MACHINE_NAME = p_server_machine_name
AND SERVER_PORT_NUMBER = p_server_port_number
AND LOGOFF_DATE IS NULL;
INSERT INTO MTL_MOBILE_LOGIN_HIST (
USER_ID,
LOGON_DATE,
SERVER_MACHINE_NAME,
SERVER_PORT_NUMBER,
CLIENT_MACHINE_NAME,
CLIENT_PORT_NUMBER
) VALUES(
p_user_id,
SYSDATE,
substr(p_server_machine_name,1,95),
p_server_port_number,
substr(p_client_machine_name,1,95),
p_client_port_number);
UPDATE MTL_MOBILE_LOGIN_HIST SET
LOGOFF_DATE = SYSDATE,
EVENT_MESSAGE = p_event_message
WHERE USER_ID = p_user_id
AND SERVER_MACHINE_NAME = substr(p_server_machine_name,1,95)
AND SERVER_PORT_NUMBER = p_server_port_number
AND LOGOFF_DATE IS NULL;