/*****************************************************************************
*
* Filename         - $Workfile:   dcs_up_down.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         - Live Schema Stored Procedure
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   dcs_up_down.sql  $  $Revision:   1.5  $
*
* 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:   /shared/pvcs/tagtarch/db_ora/db/source/live/procedures/dcs_up_down.sqv  $
* 
*    Rev 1.5   02 Apr 1998 19:32:36   tagtrak
* OR:
* CR:
* REV:
* Initial Issue
* See label for concession
* 
*    Rev 1.4   15 Jan 1998 12:11:32   tagtrak
* OR: OR11101, TN13, TN15
* CR:
* REV:
* Phase 2C to Phase 3 upgrade plus code review actions and resolving some technical isses.
* 
*    Rev 1.3   24 Oct 1997 11:02:58   tagtrak
* Added PVCS header information
*
****************************************************************************/

PROMPT create or replace procedure dcs_up_down

create or replace procedure dcs_up_down (
	p_proc     in  char,
	p_unit     in  char,
	p_dcsid    in  char,
	p_subunit  in  char,
	p_dcs_sts  in  char
)
as  

begin

	/*
	 * - IF p_subunit is not equal to '-' (ie. not null) then
	 *   update the system_cfg table by setting the dcs_status to the
	 *    parameter passed in where the process_name, unit_name, dcsid
	 *    and subunit_name are the same as the parameters passed in
	 * - else
	 *   update the system_cfg table by setting the dcs_status to the
	 *    parameter passed in where the process_name, unit_name,  and
	 *    dcsid are the same as the parameters passed in
	 */
																																								
	if (p_subunit != '-') then 

		update
			system_cfg
		set 
			dcs_status   =  p_dcs_sts
		where
			process_name =  p_proc  and
			unit_name    =  p_unit  and
			dcsid        =  p_dcsid and
			subunit_name =  p_subunit;

	else 

		update
			system_cfg
		set 
			dcs_status   =  p_dcs_sts
		where
			process_name = p_proc and
			unit_name    = p_unit and
			dcsid        = p_dcsid;

	end if;

	/*
	 * We may want to mail someone but I don't
	 * think anyone cares at the moment.
	 */	

end dcs_up_down;
/
