/*****************************************************************************
*
* Filename         - $Workfile:   add_log_rec.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - See revision history below.
* Last Update      - See revision history below.
*
* Project Name     - TAGTRAK(Oracle database)
*
* Source Code
* Identifier       - 0/3/300/8010/112
*
* Design Spec
* Section          - 
*
* Contents         - add_log_rec stored procedure
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1998
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   add_log_rec.sql  $  $Revision:   1.3  $
*
* Revision History
*
* Note that user tagtrak is many users. For these users the user
* name is entered as the last line in the change description.
*
* $Log:   /pvcsarch/db_ora/db/source/live/procedures/add_log_rec.svl  $
* 
*    Rev 1.3   21 Jun 2001 14:38:14   tagtrak
* OR:
* CR:
* Re-baseline version 4.0.0 to include patches.
* 
*    Rev 1.2   20 Sep 1999 14:40:02   tagtrak
*  
* 
*    Rev 1.1   02 Apr 1998 19:31:32   tagtrak
* OR:
* CR:
* REV:
* Initial Issue
* See label for concession
* 
*    Rev 1.0   26 Feb 1998 10:18:40   tagtrak
* OR:
* CR:
* REV:
* Initial core product version
*
****************************************************************************/

/*
 * add_log_rec - add a record to the log_table.
 */
PROMPT create or replace procedure add_log_rec

create or replace procedure add_log_rec (
	p_category     log_table.category%type,
	p_reason       log_table.reason%type,
	p_userid       tagtrak_users.user_id%type
)
as
PRAGMA AUTONOMOUS_TRANSACTION;
 
depcode site_info.airport_code%type;
begin
   depcode := multi_site.get_user_loc(p_userid); 
	/*
	 * The record_id will be assigned automatically by the trigger.
	 */
	insert into log_table
		( user_id, log_time, reason, category )
	values
		( p_userid, SYSDATE + get_offset.airport_code(depcode), p_reason, p_category );
   commit;

end add_log_rec;
/
