搜索

Oracle存储过程读写文件

发表于 2025-11-04 00:14:44 来源:全栈开发
Oracle存储过程读写文件
复制CREATE OR REPLACE PROCEDURE V3_SUB_FETCH_TEST_2   (      V_TEMP VARCHAR2,存储      --1为成功,0为失败      v_retvalue   OUT NUMBER     )   AS     --游标定义     type ref_cursor_type is REF CURSOR;     cursor_select   ref_cursor_type;     select_cname    varchar2(1000);     v_file_handle   utl_file.file_type;     v_sql varchar2(1000);     v_filepath Varchar2(500);     v_filename Varchar2(500);     --缓冲区     v_results Varchar2(500);     v_pid varchar2(1000);     v_cpcnshortname Varchar2(500);     begin         v_filepath := V_TEMP;         if v_filepath is null then            v_filepath := /home/zxin10/file3;         end if;   v_filename:=free_|| substr(to_char(sysdate,过程YYYYMMDDHH24MI),1,10) ||.all ;         --游标开始   select_cname:=select cpid,cpcnshortname from zxdbm_ismp.scp_basic;          --打开一个文件句柄 ,同时fopen的云南idc服务商***个参数必须是香港云服务器大写      v_file_handle:=utl_file.fopen(BBB,v_filename,A);         Open cursor_select For select_cname;            Fetch  cursor_select into v_pid,v_cpcnshortname;         While  cursor_select%Found            Loop         v_results := v_pid|||||v_cpcnshortname;         --将v_results写入文件         utl_file.put_line(v_file_handle,v_results);            Fetch  cursor_select into v_pid,v_cpcnshortname;               End Loop;         Close cursor_select;--关闭游标         utl_file.fClose(v_file_handle);--关闭句柄         v_retvalue :=1;     exception when others then            v_retvalue :=0;      end V3_SUB_FETCH_TEST_2;  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.云服务器提供商
随机为您推荐
版权声明:本站资源均来自互联网,如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

Copyright © 2016 Powered by Oracle存储过程读写文件,全栈开发  滇ICP备2023006006号-32sitemap

回顶部