Базы данных Oracle - статьи



             

Решение - часть 2


FUNCTION tempfilename RETURN VARCHAR2 IS BEGIN RETURN (USERDBMS_RANDOM.STRING('U', 10)); END tempfilename;

FUNCTION setup_items (blk_in IN VARCHAR2)
RETURN PLS_INTEGER /* Определим находящиеся на экране
столбцы текущего блока */ IS cur_item_v VARCHAR2(30); last_item_v VARCHAR2(30); index_v PLS_INTEGER := 0; BEGIN cur_item_v := GET_BLOCK_PROPERTY (blk_in, FIRST_ITEM); last_item_v := GET_BLOCK_PROPERTY (blk_in, LAST_ITEM); item_tab.DELETE;

LOOP IF GET_ITEM_PROPERTY (blk_in'.'
cur_item_v, DISPLAYED) = 'TRUE' AND GET_ITEM_PROPERTY (blk_in'.'
cur_item_v, VISIBLE) = 'TRUE' AND GET_ITEM_PROPERTY (blk_in'.'
cur_item_v, ITEM_CANVAS) IS NOT NULL AND GET_ITEM_PROPERTY (blk_in'.'
cur_item_v, ITEM_TYPE) IN ('TEXT ITEM', 'LIST',
'DISPLAY ITEM','CHECKBOX', 'RADIO GROUP') THEN index_v := index_v + 1; item_tab(index_v).name :=
GET_ITEM_PROPERTY(blk_in'.'cur_item_v, ITEM_NAME); IF GET_ITEM_PROPERTY (blk_in
'.'cur_item_v, ITEM_TYPE) = 'CHECKBOX' THEN item_tab(index_v).prompt :=
GET_ITEM_PROPERTY(blk_in'.'cur_item_v, LABEL); ELSE item_tab(index_v).prompt :=
GET_ITEM_PROPERTY(blk_in'.'cur_item_v, PROMPT_TEXT); END IF; item_tab(index_v).datatype := GET_ITEM_PROPERTY(blk_in'.'
cur_item_v, DATATYPE); END IF;

EXIT WHEN cur_item_v = last_item_v; cur_item_v := GET_ITEM_PROPERTY (blk_in
'.'cur_item_v, NEXTITEM); END LOOP;

RETURN (index_v); END setup_items;

FUNCTION format_value ( value_in IN VARCHAR2, datatype_in IN VARCHAR2 DEFAULT NULL ) RETURN VARCHAR2 IS retval VARCHAR2(32767) := value_in; BEGIN IF datatype_in = 'DATE' THEN retval := TO_CHAR(TO_DATE(retval),
date_format_pc); ELSE retval := REPLACE (retval, CHR(9),
chr9subst_pc); retval := REPLACE (retval, CHR(10),
chr10subst_pc); IF SUBSTR(retval, 1, 1) IN
('-', '+', '=') THEN retval := ' ' retval; END IF; END IF;

RETURN (retval); END format_value; /* ---------- PUBLIC MODULES ----------- */ PROCEDURE to_excel IS cur_block_c CONSTANT VARCHAR2(30)
:= NAME_IN ('SYSTEM.CURSOR_BLOCK'); cur_item_c CONSTANT VARCHAR2(61)
:= NAME_IN ('SYSTEM.CURSOR_ITEM'); cur_record_c CONSTANT VARCHAR2(30)
:= NAME_IN ('SYSTEM.CURSOR_RECORD'); outfilename_v VARCHAR2(255); -- := 'c:\tmp\'USER'.xls';
-- test in C-S mode outfile_v TEXT_IO.FILE_TYPE; num_items_v PLS_INTEGER; line_v VARCHAR2(32767); counter_v PLS_INTEGER := 0;




Содержание  Назад  Вперед