rem {{ -----------------------------------------------------------------------+ rem File: jrigutil.jpb rem Author: rem Date: rem Version: rem Project: The Oracle Common Repository rem Description: Repos utils rem Notes: rem RealAuth: Karl McHorton rem IncepDate: 20th March 1998 rem Copyright: (c) Oracle Corporation 1998. All Rights Reserved. rem Tagline: -- Oracle Repository: Managing *all* your data -- rem --------------------------------------------------------------------------+ rem Log of Changes rem --------------------------------------------------------------------------+ rem Revision 1 2000/11/02 sbhagava rem Bug 1311500: Creating a table DUAL causes all objects to disappear rem Changed dual to sys.dual to fix bug 1311500 rem prompt Package Body: jr_util create or replace package body jr_util is ----------------------------------------------------------------------------- -- Private data ----------------------------------------------------------------------------- -- Package variable to hold current irid current_irid irid; ----------------------------------------------------------------------------- -- Private methods ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- Function : hex_to_number ----------------------------------------------------------------------------- function hex_to_number (strhex in varchar2) return number is numhex number; begin numhex := 0; for i in 1..length(strhex) loop numhex := numhex * 16; numhex := numhex + instr('0123456789ABCDEF', substr(strhex, i, 1)) - 1; end loop; return numhex; end hex_to_number; ----------------------------------------------------------------------------- -- Function : is_windows_server_host ----------------------------------------------------------------------------- -- Note, depends on the 'TNS for xxx' entry being present -- in the server product list in PRODUCT_COMPONENT_VERSION -- function is_windows_server_host return boolean is nEntries number; begin select count(*) into nEntries from PRODUCT_COMPONENT_VERSION PCV where upper(PCV.PRODUCT) like ('%WINDOWS%'); if nEntries = 0 then return false; else return true; end if; end is_windows_server_host; ----------------------------------------------------------------------------- -- Public methods ----------------------------------------------------------------------------- function get_new_irid return irid is irid_new irid; guid_hex varchar2(32); ruid_hex varchar2(31); begin -- old method of generation of ids -- SELECT sdd_irid_seq.NEXTVAL INTO the_irid FROM sys.DUAL; select guid into guid_hex from jr_sys_op_guid; -- -- Different truncation schemes depending on server architecture -- if is_windows_server_host = true then ruid_hex := concat('1', concat(substr(guid_hex, 1, 12), substr(guid_hex, 15, 18))); else ruid_hex := concat(substr(guid_hex, 1, 16), substr(guid_hex, 19, 14)); end if; irid_new := hex_to_number(ruid_hex); current_irid := irid_new; return irid_new; end get_new_irid; function get_current_irid return irid is begin return current_irid; end get_current_irid; end jr_util; / rem rem ---------------------------------------------------------------------------+ rem }} end of file rem ---------------------------------------------------------------------------+