Home » SQL & PL/SQL » SQL & PL/SQL » EXCEL UPLOAD
EXCEL UPLOAD [message #185089] Mon, 31 July 2006 00:05 Go to next message
ora_work
Messages: 4
Registered: July 2006
Junior Member
hi all,
there is a excel file on the client and i want that file to upload on the server.
i have been told that i have to use oracle's package UTL_FILE.
can anyone provide me the script or atleast the way that how should i approach the problem.
what should be done?
waiting for reply
THANKS in advance
Re: EXCEL UPLOAD [message #185102 is a reply to message #185089] Mon, 31 July 2006 00:50 Go to previous messageGo to next message
amit_kiran
Messages: 50
Registered: July 2006
Location: UK
Member

You can upload an Excel file using UTL_FILE package.

First parameter you need to change is UTL_FILE_DIR = 'c:\***'
Make this as your default directory in which file is stored.

PROCEDURE READ_FILE
(file_name IN VARCHAR2)
as
/* File declarations*/
FILE_HANDLE UTL_FILE.FILE_TYPE;
FILE_DIRECTORY VARCHAR2(100):= 'PATH AND FILE NAME';
RESULT VARCHAR2(32765);
IS_READING BOOLEAN := TRUE;
ROW_COUNT NUMBER := 0;
BEGIN
FILE_HANDLE := UTL_FILE.FOPEN(FILE_DIRECTORY, file_name, 'r', 32767);
WHILE (IS_READING) LOOP
BEGIN
UTL_FILE.GET_LINE(FILE_HANDLE, RESULT);
-- Test is stored in RESULT, Perform your activity here.
ROW_COUNT := ROW_COUNT + 1;
EXCEPTION
WHEN NO_DATA_FOUND THEN
IS_READING := FALSE;
EXIT;
END;
END;
Re: EXCEL UPLOAD [message #185193 is a reply to message #185089] Mon, 31 July 2006 08:05 Go to previous message
Aju
Messages: 94
Registered: October 2004
Member
You may also consider getting the data using external table. Here is a link

http://www.adp-gmbh.ch/ora/misc/ext_table.html
Previous Topic: Change of column positions..
Next Topic: where current of
Goto Forum:
  


Current Time: Fri Dec 09 12:02:24 CST 2016

Total time taken to generate the page: 0.10805 seconds