Oracle存储过程读写文件

系统运维2025-11-04 07:46:263564
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的亿华云***个参数必须是网站模板大写      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.源码库
本文地址:http://www.bhae.cn/html/217c6599717.html
版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。

全站热门

电脑关机提示异常错误,你需要知道的一切!(解决电脑关机异常错误问题,避免数据丢失与系统损坏)

程序员如何开发高效的程序,这项技术值得了解

详解Java开发Web应用程序的底层原理

美国程序员们的工资这么高,程序员的你在什么水平呢?

电脑手绘装修柜子教程(学习如何使用电脑手绘技巧来装修你的柜子,让家居更加个性化)

让Python程序快30%的技巧

Node.js模块系统源码探微

2020年,前端开发人员应该学习的10件事

友情链接

滇ICP备2023000592号-9