/*****************************************************************************
*
* Filename         - $Workfile:   hash_key.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, 2000
*
*****************************************************************************/
PROMPT CREATE OR REPLACE FUNCTION hash_key

CREATE OR REPLACE
FUNCTION hash_key(key IN VARCHAR2) RETURN INTEGER IS
	BEGIN
		RETURN TO_NUMBER
			(	 ASCII(SUBSTR(key,1,1))
			|| ASCII(SUBSTR(key,2,1)) 
			|| ASCII(SUBSTR(key,3,1))
			|| (SUBSTR(key,4,4))
			|| ASCII(SUBSTR(key,8,1))
			|| (SUBSTR(key,9,2))
			|| TO_CHAR(TO_DATE(SUBSTR(key,11,3),'MON'),'MM')
			);
	END hash_key;
/
