/*****************************************************************************
*
* Filename         - $Workfile:   derive_seq_no.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         - Stored function derive_seq_no
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1998
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   derive_seq_no.sql  $  $Revision:   1.2  $
*
* 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/derive_seq_no.svl  $
* 
*    Rev 1.2   21 Jun 2001 10:04:44   tagtrak
* OR:
* CR:
* Re-baseline version 4.0.0 to include patches.
* 
* 
*    Rev 1.1   20 Sep 1999 14:40:34   tagtrak
*  
* 
*    Rev 1.0   02 Sep 1998 17:34:02   tagtrak
* OR:
* CR:
* REV:
* Initial check-in to PVCS
*
****************************************************************************/

/*
 * derive_seq_no
 * Used in view pax_v1 to display sequence number as null
 * if it is greater than the threshold value (i.e. created
 * by Tagtrak.
 */

PROMPT create or replace function derive_seq_no

create or replace function derive_seq_no (
	seqno in number
      , dcs_seqno in number
)
	return number
is

	result number;
	threshold number := 999;

begin

	if ( seqno > threshold ) then
                result := dcs_seqno;
	else
		result := seqno;
	end if;

	return result;

end derive_seq_no;
/
