PL/SQL详例和解释(四)

2015-01-25 19:54:28 · 作者: · 浏览: 31
; when UTL_FILE.WRITE_ERROR THEN DBMS_OUTPUT.PUT_LINE('THE FILE CANNOT BE WRITTEN!'); WHEN UTL_FILE.INVALID_PATH THEN DBMS_OUTPUT.PUT_LINE('PATH IS INVALID!'); END; BEGIN emp_number('D_OUTPUT','user_log.log'); END; --运用utl_file来读file create or replace procedure read_file (file_dir in varchar2, file_name in varchar2) as file_handler utl_file.file_type; file_content varchar2(1024); begin file_handler:=utl_file.fopen(file_dir, file_name, 'R'); loop utl_file.get_line(file_handler,file_content); DBMS_OUTPUT.PUT_LINE(file_content); end loop; exception when no_data_found then utl_file.fclose(file_handler); end; begin read_file('D_OUTPUT','user_log.log'); end; -- create or replace procedure my_first_page as begin htp.
html
open; htp.headopen; htp.title('My First Page'); htp.headclose; htp.bodyopen; htp.p('

This is my first web page!

'); htp.bodyclose; htp.htmlclose; exception when others then htp.p('ERROR OCCUR!'); end; begin my_first_page; end;