Import CSV directly into FORM 6 and d2kwutil and reading from file (win_api_file.read_file)(merged) [message #296844] |
Tue, 29 January 2008 04:37 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
pc131
Messages: 36 Registered: May 2006
|
Member |
|
|
Hi
I know that this topic in not new, but maybe my case is a bit different than common.
My form has multi-record block (4 columns) in which i want to upload CSV file.
The form will have "Browse..." button to piont CSV file (on local users disc, not where Forms server resides) after pointing the CSV file, user will press UPLOAD button which will import CSV data into block. After that data is visible in block. But whole form must not be refreshed.
I'm studying about UTL_FILE package, but it seems it allows manipulating files on server not local user's machines. Do Forms have such "Browse... -> UPLOAD" possibility or I need to learn Java and create Java funcionality inside Forms?
Or it is impossible to load data directly into form? (I have to use SQLoader and load data into temp table then into block on form????)
Any help will be appreciated.
Tom
[Updated on: Tue, 29 January 2008 06:41] Report message to a moderator
|
|
|
Re: Import CSV directly into FORM [message #296940 is a reply to message #296844] |
Tue, 29 January 2008 09:56 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
pc131
Messages: 36 Registered: May 2006
|
Member |
|
|
Sorry for replying my own topic, but i'm really in need of solution...
Any help form anyone? This is not common situation. I cannot use sqldr because many users will upload files (and i wont have rights to run programs on unix where oracle resides), and sqldr can upload into tables one specified file. Moreover i feel like better solution is to point CSV file using Brows... button, and then import data from CSV straight into form (no sqldr no tables...)
Anyone has idea on this?
[Updated on: Tue, 29 January 2008 09:57] Report message to a moderator
|
|
|
|
|
d2kwutil and reading from file (win_api_file.read_file) [message #297198 is a reply to message #296844] |
Wed, 30 January 2008 10:39 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
pc131
Messages: 36 Registered: May 2006
|
Member |
|
|
Hi Oracle Gurus
I am using Oracle Forms 6i and i have to use D2KWUTIL.PLL library for file manipulation. I did dialog window to chose file, I succesfully loaded its name into PL/SQL but i have trouble using WIN_API_FILE.READ_FILE function, do you have any examples of code to read lines from file? It will be CSV file separated by ";" lines ended by Enter(CHR(10))
So far I have:
declare
filename varchar2(256); -- full path to file
filemode1 char := 'R'; --for read
file1 win_api.file_type; -- file type variable
raise_exc BOOLEAN := FALSE; --not sure here
buffer1 varchar2(100); --not sure here
read_file1 BOOLEAN := FALSE; --reading file
bytes_read number(2); --not sure
begin
filename := WIN_API_DIALOG.OPEN_FILEEX('Choose File...','%HOMEPATH%','details.csv |details.csv|');
file1 := WIN_API_FILE.OPEN_FILE(filename, filemode1, raise_exc); --works here i can later put full path on dialog
read_file1:=WIN_API_FILE.READ_DATA(file1, buffer1, 19, false, bytes_read, raise_exc); -- errors
WIN_API_FILE.CLOSE_FILE(file1, raise_exc);
msg('The chosen file is: '||CHR(10)||CHR(10)||filename||CHR(10)||CHR(10)||buffer1);
end;
And this code produces error in runtime ORA-06503:
which says
Error:
ORA-06503: PL/SQL: Function returned without value
Cause:
You tried to call a PLSQL function, but the function was missing a RETURN statement.
Everything went fine until i tried to read from file, putting dialog with just full path number works.
Anyone can help? Web_Util won't work with Forms 6i so i'm stacked to d2kwutil.... How to read from text file???
Thanks in advance
Tom
|
|
|
|
|
|