1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| DROP TABLE plx_distrib
/
DROP DIRECTORY plx_directory
/
CREATE TABLE plx_distrib
(DISTRIB_ID INTEGER
,DISTRIB_NAME VARCHAR2(32)
,DISTRIB_PARAM VARCHAR2(100)
)
/
CREATE DIRECTORY plx_directory AS '/usr/tmp'
/
SET SERVEROUTPUT ON SIZE 1000000
DECLARE
l_record_counter INTEGER;
l_nested_counter INTEGER;
C_MAX_CUSTOMER INTEGER := 100;
BEGIN
l_record_counter := 0;
FOR j IN (SELECT extractValue(value(ct),'distrib/distrib_id') Distrib_id
,extractValue(value(ct),'distrib/distrib_name') Distrib_name
,extractValue(value(ct),'distrib/distrib_param') Distrib_param
FROM TABLE(XMLSequence(extract(XMLTYPE(bfilename('PLX_DIRECTORY','distrib.xml'),nls_charset_id('AL32UTF8')),'/message/distrib'))) ct) LOOP
l_record_counter := l_record_counter + 1;
dbms_output.put_line('Processing record '||TO_CHAR(l_record_counter));
dbms_output.put_line('Distrib Id ' ||j.distrib_id);
dbms_output.put_line('Distrib Name ' ||j.distrib_name);
INSERT INTO plx_distrib
(distrib_id
,distrib_name
,distrib_param)
VALUES
(j.distrib_id
,j.distrib_name
,j.distrib_param)
;
END LOOP;
END;
/
COL distrib_id FOR 999
COL distrib_name FOR A15
COL distrib_param FOR A40
SELECT *
FROM plx_distrib
/
COMMIT
/
EXIT |
Partager