SAK }‘ŠÙ
Oracle PL/SQL •Ò15 - ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê—— CSV o—ÍAHTML o—Í
¡ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê—— CSV o—Í EŽŸ‚̃Tƒ“ƒvƒ‹‚ÍAƒ†[ƒUƒIƒuƒWƒFƒNƒg‚̈ꗗ‚ð CSV Œ`Ž®‚ÉŒ©o‚µ•t‚«‚Åo —Í‚µ‚Ü‚·BCSV ‚Ìo—ÍŒ`Ž®‚ÍA‹æØ‚è‹L†‚ɃJƒ“ƒ}u,vAˆø—p‹å‚Ƀ_ƒtƒ‹ ƒR[ƒe[ƒVƒ‡ƒ“u"v‚ðŽg—p‚µ‚Ä‚¢‚Ü‚·B (‚·‚ׂẴe[ƒuƒ‹A‘S‚Ẵe[ƒuƒ‹A“o˜^‚³‚ê‚Ä‚¢‚éƒe[ƒuƒ‹A•\ˆê——Aƒe[ƒuƒ‹–¼•\Ž¦) (‚·‚ׂẴrƒ…[A‘S‚Ẵrƒ…[A“o˜^‚³‚ê‚Ä‚¢‚éƒrƒ…[Aƒrƒ…[ˆê——) (‚·‚ׂẴpƒbƒP[ƒWA‘S‚ẴpƒbƒP[ƒWA“o˜^‚³‚ê‚Ä‚¢‚éƒpƒbƒP[ƒWAƒpƒbƒP[ƒWˆê——) (‚·‚ׂẴXƒgƒAƒhƒvƒƒVƒWƒƒA‘S‚ẴXƒgƒAƒhƒvƒƒVƒWƒƒ) (“o˜^‚³‚ê‚Ä‚¢‚éƒXƒgƒAƒhƒvƒƒVƒWƒƒAƒXƒgƒAƒhƒvƒƒVƒWƒƒˆê——) declare dnm varchar2(200) := 'g:\tmp'; -- ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê——o—̓pƒX fnm varchar2(200) := 'test.csv'; -- ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê——o—̓tƒ@ƒCƒ‹–¼ cursor cu is select lower(object_name) as ƒIƒuƒWƒFƒNƒg, lower(object_type) as ƒ^ƒCƒv, to_char(created, 'yyyy.mm.dd hh24:mi:ss') as 쬓ú•t, to_char(last_ddl_time, 'yyyy.mm.dd hh24:mi:ss') as XV“ú•t from user_objects order by object_type, object_name; fno utl_file.file_type; -- ƒtƒ@ƒCƒ‹ƒnƒ“ƒhƒ‹ rec varchar2(2000); -- o—̓oƒbƒtƒ@ begin -- ƒtƒ@ƒCƒ‹ƒI[ƒvƒ“ fno := utl_file.fopen(dnm, fnm, 'W', 2002); -- Œ©o‚µƒ‰ƒCƒg utl_file.putf(fno, '"%s","%s","%s","%s"\n', 'ƒ^ƒCƒv', 'ƒIƒuƒWƒFƒNƒg', '쬓ú•t', 'XV“ú•t'); -- ƒ‰ƒCƒg begin for cu_rec in cu loop utl_file.putf(fno, '"%s","%s","%s","%s"\n', cu_rec.ƒ^ƒCƒv, cu_rec.ƒIƒuƒWƒFƒNƒg, cu_rec.쬓ú•t, cu_rec.XV“ú•t); end loop; exception when OTHERS then dbms_output.put_line('** ƒ‰ƒCƒgƒGƒ‰['); end; -- ƒtƒ@ƒCƒ‹ƒNƒ[ƒY utl_file.fclose(fno); end; / -- test.csv o—ÍŒ‹‰Ê -- "ƒ^ƒCƒv","ƒIƒuƒWƒFƒNƒg","쬓ú•t","XV“ú•t" "function","gettmp","2002.01.05 13:01:35","2002.03.02 19:03:09" "index","sys_c002112","2002.01.05 13:01:52","2002.01.05 13:01:52" "index","sys_c002113","2002.01.05 13:01:11","2002.01.05 13:01:11" "table","ipm","2002.01.05 14:01:49","2002.01.05 14:01:49" "table","msgm","2002.01.05 13:01:05","2002.01.05 13:01:05" "table","ƒR[ƒhm","2002.01.05 13:01:36","2002.01.05 13:01:36" "table","ƒeƒXƒgm","2002.01.05 13:01:28","2002.01.05 13:01:28" "view","msgv1","2002.01.05 13:01:06","2002.01.05 13:01:06" ¡ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê—— HTML o—Í EŽŸ‚̃Tƒ“ƒvƒ‹‚ÍAƒ†[ƒUƒIƒuƒWƒFƒNƒg‚̈ꗗ‚ð HTML Œ`Ž®‚Éo—Í‚µ‚Ü‚·B declare dnm varchar2(200) := 'g:\tmp'; -- ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê——o—̓pƒX fnm varchar2(200) := 'test.htm'; -- ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê——o—̓tƒ@ƒCƒ‹–¼ cursor cu is select lower(object_name) as ƒIƒuƒWƒFƒNƒg, lower(object_type) as ƒ^ƒCƒv, to_char(created, 'yyyy.mm.dd hh24:mi:ss') as 쬓ú•t, to_char(last_ddl_time, 'yyyy.mm.dd hh24:mi:ss') as XV“ú•t from user_objects order by object_type, object_name; fno utl_file.file_type; -- ƒtƒ@ƒCƒ‹ƒnƒ“ƒhƒ‹ rec varchar2(2000); -- o—̓oƒbƒtƒ@ begin -- ƒtƒ@ƒCƒ‹ƒI[ƒvƒ“ fno := utl_file.fopen(dnm, fnm, 'W', 2002); -- HTML ƒwƒbƒhƒ‰ƒCƒg utl_file.put_line(fno, '<HTML>'); utl_file.put_line(fno, '<HEAD>'); utl_file.put_line(fno, '<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">'); utl_file.put_line(fno, '</HEAD>'); utl_file.put_line(fno, '<BODY>'); utl_file.put_line(fno, '<CENTER>'); utl_file.put_line(fno, '<TABLE border=1 bordercolordark=White bordercolorlight=#a0a0a0 cellPadding=3 cellSpacing=0>'); utl_file.put_line(fno, '<TBODY bgcolor=#f0f0f0 align="left">'); utl_file.put_line(fno, '<TR bgcolor=#d0d0d0 align="center">'); utl_file.put_line(fno, '<TD colspan="4">ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê——</TD>'); utl_file.put_line(fno, '</TR>'); utl_file.put_line(fno, '<TR bgcolor=#d0d0d0 align="center">'); utl_file.put_line(fno, '<TD>ƒ^ƒCƒv</TD>'); utl_file.put_line(fno, '<TD>ƒIƒuƒWƒFƒNƒg</TD>'); utl_file.put_line(fno, '<TD>쬓ú•t</TD>'); utl_file.put_line(fno, '<TD>XV“ú•t</TD>'); utl_file.put_line(fno, '</TR>'); -- HTML ƒ{ƒfƒBƒ‰ƒCƒg begin for cu_rec in cu loop utl_file.putf(fno, '<TR><TD>%s</TD><TD>%s</TD><TD>%s</TD><TD>%s</TD></TR>\n', cu_rec.ƒ^ƒCƒv, cu_rec.ƒIƒuƒWƒFƒNƒg, cu_rec.쬓ú•t, cu_rec.XV“ú•t); end loop; exception when OTHERS then dbms_output.put_line('** ƒ‰ƒCƒgƒGƒ‰['); end; -- HTML ƒeƒCƒ‹ƒ‰ƒCƒg utl_file.put_line(fno, '</TBODY>'); utl_file.put_line(fno, '</TABLE>'); utl_file.put_line(fno, '</CENTER>'); utl_file.put_line(fno, '</BODY>'); -- ƒtƒ@ƒCƒ‹ƒNƒ[ƒY utl_file.fclose(fno); end; / -- test.htm ƒuƒ‰ƒEƒYƒCƒ[ƒW --
ƒ†[ƒUƒIƒuƒWƒFƒNƒgˆê—— | |||
ƒ^ƒCƒv | ƒIƒuƒWƒFƒNƒg | 쬓ú•t | XV“ú•t |
function | gettmp | 2002.01.05 13:01:35 | 2002.03.02 19:03:09 |
index | sys_c002112 | 2002.01.05 13:01:52 | 2002.01.05 13:01:52 |
index | sys_c002113 | 2002.01.05 13:01:11 | 2002.01.05 13:01:11 |
table | ipm | 2002.01.05 14:01:49 | 2002.01.05 14:01:49 |
table | msgm | 2002.01.05 13:01:05 | 2002.01.05 13:01:05 |
table | ƒR[ƒhm | 2002.01.05 13:01:36 | 2002.01.05 13:01:36 |
table | ƒeƒXƒgm | 2002.01.05 13:01:28 | 2002.01.05 13:01:28 |
view | msgv1 | 2002.01.05 13:01:06 | 2002.01.05 13:01:06 |
¡Oracle PL/SQL •ÒŽ‘—¿
¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
¡SQL Šî‘b•ÒŽ‘—¿
¡SQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—¿
¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡MySQL •ÒŽ‘—¿