REM--------------------------------------------------------------------------------------------------------- REM-- Copywright 2000, chet west REM--------------------------------------------------------------------------------------------------------- REM REM NAME: type_entity_gen REM REM PURPOSE: Type entity generator. Used to build commonly used entities that REM define or classify data found in other entities. REM REM PARAMETERS: NAME TYPE DESCRIPTION REM --------------- -------- ----------------------------------- REM p_entity_name VARCHAR2 Name of the type entity. REM p_entity_desc VARCHAR2 Description of the type entity. REM REM RETURN VALUE: Repository ID of the new entity. REM REM NOTES: REM 1) Create the entity using the name and description passed in. REM 2) Create the following attributes for the entity: REM NAME TYPE/DOMAIN COMMENT/DESCRIPTION REM -------------- --------------- --------------------------------------- REM - CODE VARCHAR2/CODE Short name, abbreviation or acronym for this . REM - NAME VARCHAR2/NAME An official name for this . REM - DESCRIPTION VARCHAR2/DESCRIPTION A detailed description for this . REM - EFFECTIVE DATE DATE/DATE_EFFECTIVE This can be used on or after this date. REM - EXPIRE DATE DATE/DATE_EXPIRED This cannot be used after this date. REM REM 3) Code and Name will be set as Unique Identifiers. REM REM GENESIS: Chester R. West II - 09/29/2000 REM MODIFICATION HISTORY: REM NAME DATE CHANGE DESCRIPTION REM -------------- -------- --------------------------------------- REM REM--------------------------------------------------------------------------------------------------------- REM This is a wide report, so set the line width accordingly. set linesize 132 set pagesize 66 REM Let's not clutter up the screen and page with program code. REM set verify off REM set echo off REM set feedback off REM Force diagnostic output on so that the user can see what progress REM is being made and what the program did. REM Increase the size of this buffer if your application is very large REM and you get a buffer-overflow error. SET serveroutput ON SET serveroutput ON SIZE 1000000 PROMPT Enter the Context Workarea Name DEFINE p_context_workarea_name='&1' PROMPT Enter the Application System Name DEFINE p_appl_sys_name='&2' PROMPT Enter the output filename DEFINE p_filename='&3' PROMPT Enter the Type Entity Name DEFINE p_entity_name='&4' PROMPT Enter the Type Entity Short Name DEFINE p_entity_short_nm='&5' PROMPT Enter the Type Entity Plural Name DEFINE p_entity_plural_nm='&6' SPOOL &p_filename DECLARE -- create type entity definition. lws_entity_id NUMBER; lws_attrib_id NUMBER; BEGIN -- -- Initialize d2k_api_util.show_messages_on; d2k_api_util.initialize_api('&p_context_workarea_name','&p_appl_sys_name'); -- -- Date Domains -- lws_entity_id := d2k_api_util.create_entity('&p_entity_name' ,'&p_entity_short_nm' ,'&p_entity_plural_nm'); IF lws_entity_id IS NOT NULL THEN lws_attrib_id := d2k_api_util.create_attribute('&p_entity_name','CODE' ,10,'N','CODE','VARCHAR2',8,NULL,'The code for this &p_entity_name..'); lws_attrib_id := d2k_api_util.create_attribute('&p_entity_name','NAME' ,20,'N','NAME','VARCHAR2',8,NULL,'The name for this &p_entity_name..'); lws_attrib_id := d2k_api_util.create_attribute('&p_entity_name','DESCRIPTION' ,30,'Y','DESCRIPTION','VARCHAR2',8,NULL,'The description for this &p_entity_name..'); lws_attrib_id := d2k_api_util.create_attribute('&p_entity_name','EFFECTIVE DATE',40,'N','DATE_EFFECTIVE','DATE',NULL,NULL,'The effective date for this &p_entity_name..'); lws_attrib_id := d2k_api_util.create_attribute('&p_entity_name','EXPIRE DATE' ,50,'Y','DATE_EXPIRED','DATE',NULL,NULL,'The expiration date for this &p_entity_name..'); END IF; DBMS_OUTPUT.PUT_LINE('Type Entity program finished.'); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('Error : ' || SQLCODE || ', ' || SQLERRM); DBMS_OUTPUT.PUT_LINE('Procedure aborted with errors!'); END;