/*****************************************************************************
*
* Filename         - $Workfile:   get_carrier_code2.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:   get_carrier_code2.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:   /shared/pvcs/tagtarch/db_ora/db/source/live/procedures/get_carrier_code2.sqv  $
* 
*    Rev 1.3   02 Apr 1998 19:35:06   tagtrak
* OR:
* CR:
* REV:
* Initial Issue
* See label for concession
* 
*    Rev 1.2   24 Oct 1997 11:10:16   tagtrak
* Added PVCS header information
*
****************************************************************************/

PROMPT create or replace procedure get_carrier_code2

create or replace procedure

get_carrier_code2 (
	p_alpha_code       in char,
	ret_bar_code       in out char
) as

found boolean := TRUE;
 
begin

	/* get the carrier bar code */

	begin

		select
			bar_code
		into
			ret_bar_code
		from
			carrier_lookup
		where
			alpha_code = p_alpha_code;
		
		/*
		 * Added for Oracle port.
		 */
		exception
			when NO_DATA_FOUND then
				found := FALSE;

	end;


	if ( not found ) then

		begin

			select
				rpad(db_value, 3)
			into
				ret_bar_code
			from
				db_config
			where
				db_item = 'def_carr_des';

			/*
			 * Added for Oracle port.
			 */
			exception
				when NO_DATA_FOUND then
					ret_bar_code := '';

		end;

	end if;

end get_carrier_code2;
/
