SQL Script for read information from a csv file in FTP Server
2015-06-23 14:52
856 查看
DECLARE w_file_path VARCHAR2(4000) := 'XXIF_INPUT'; --all_directories.directory_name w_file_name VARCHAR2(4000) := 'lcytest001.csv'; --The file name w_file_exists BOOLEAN; w_file_length NUMBER(10) DEFAULT 0; w_file_type utl_file.file_type; w_line VARCHAR2(4000) DEFAULT NULL; w_rec_count NUMBER := 1; w_block_size BINARY_INTEGER; -- TYPE tbl_varchar2 IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER; rec_record tbl_varchar2; BEGIN -- fnd_global.apps_initialize(user_id => 1110, resp_id => 50683, resp_appl_id => 222); -- utl_file.fgetattr(w_file_path, w_file_name, w_file_exists, w_file_length, w_block_size); IF NOT w_file_exists THEN dbms_output.put_line('The File is not exist!'); END IF; -- IF w_file_length = 0 THEN dbms_output.put_line('The File is empty!'); END IF; -- w_file_type := utl_file.fopen(location => w_file_path, filename => w_file_name, open_mode => 'r', max_linesize => 32767); LOOP utl_file.get_line(w_file_type, w_line, 32767); dbms_output.put_line('Information is :' || w_line); rec_record(w_rec_count) := w_line; w_rec_count := w_rec_count + 1; END LOOP; EXCEPTION WHEN no_data_found THEN utl_file.fclose(w_file_type); END;
相关文章推荐
- 配置PLSQL Developer远程连接Oracle数据库
- 探索MySQL高可用架构之MHA(3)
- 探索MySQL高可用架构之MHA(2)
- PL/SQL Developer 导出csv文件,用excel打开中文显示乱码
- 探索MySQL高可用架构之MHA(1)
- SqlBulkCopy的使用
- pl/sql developer导出数据到excel的方法
- SQL truncate 、delete与drop区别(转)
- 辉哥用的这种方法实现ZABBIX的MYSQL批量监控
- 理解MYSQL——架构与概念
- Hadoop集群(第10期副刊)_常用MySQL数据库命令
- Hadoop集群(第10期)_MySQL关系数据库
- Windows 下Oracle数据库安装以及Oracle SQL Developer(图文详解)
- OpenLayers学习笔记8——使用servlet从mysql获取数据并标注
- 数据库学习之--Oracle 架构与MySQL架构对比
- mysql 运维角度浅谈:MySQL数据库优化
- Error Code: 2006 - MySQL server has gone away
- SqlBulkCopy(批量复制)使用方法 && SqlDataAdapter Update
- ReadingWriting files with MSSQL's OPENROWSET
- 启动mysql问题Can't open and lock privilege tables: Table 'mysql.host' doesn't exist