SQL Script for read information from a csv file in FTP Server

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;
时间: 2024-10-28 06:35:25

SQL Script for read information from a csv file in FTP Server的相关文章

SQL Script for select data from ebs and make a csv file to FTP

DECLARE CURSOR cur_lcy_test IS SELECT rcta.customer_trx_id, rcta.trx_number, rcta.trx_date FROM ra_customer_trx_all rcta WHERE rcta.customer_trx_id = 11993; -- rec_lcy_test cur_lcy_test%ROWTYPE; -- w_csv_line_num NUMBER := 0; TYPE tbl_varchar2 IS TAB

How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?

In this Document   Goal   Solution   1: How do you enable trace for an API when executed from a SQL script outside of Oracle Applications ?   2: How do you get debug log for an API when executed from a SQL script outside of Oracle Applications ?   a)

We need the sql script to query the table Ditronics.Kiosk.Journal to find journal with mismatch denom information versus amount.

CREATE TABLE #MoneyTable ( Id INT IDENTITY(1, 1) PRIMARY KEY , MoneyName VARCHAR(50) , Cents INT ) INSERT INTO #MoneyTable ( MoneyName, Cents ) VALUES ( 'UnSupported', 0 ) INSERT INTO #MoneyTable ( MoneyName, Cents ) VALUES ( 'DollarOne', 100 ) INSER

[实战二]vbs script export user information to access database

vbs script export user information to access database, vbs operate accdb source code is below ===================================== '********************************************************'*         Windows Script Source Code                   *'*Us

Delete All Umbraco Members by SQL Script (转自http://staheri.com/my-blog/2015/july/delete-all-umbraco-members-by-sql-script/)

Today I had to take the back-up off a live site and restore it on the staging server. However I had to remove all Umbraco members and thought it'd be easier to do that with SQL script than API. Despite Googling to find a firm solution (SQL script), I

csharp:SMO run sql script

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Microsoft.SqlServer.Management.Common;//需添加microsoft.sqlserv

Powercli随笔 - PowerCLI script to sequentially Storage vMotion VMs from a CSV File

PowerCLI script to sequentially Storage vMotion VMs from a CSV File This is a PowerCLI script that I use to Storage vMotion (s/vmotion) VMs from an input file (CSV File). This helps me evacuate VMs from a datastore that will be decommissioned and thi

doris: shell invoke .sql script for doris and passing values for parameters in sql script.

1. background in most cases, we want to execute sql script  in doris  routinely. using azkaban, to load data,etc.And we want to pass parameters to the sql script file. we can easily handle such situation in hive. 1.1 hive usage: using -hiveconf:  or

[PowerShell Utils] Create a list of virtual machines based on configuration read from a CSV file in Hyper-V

Hello everyone, this is the third post of the series. .   Background =============== In my solution, I have 15 Windows hosts. I need to configure them from the OS installation to configure fail over cluster and then create and run VMs on them. Withou