Hi PDMD_Support
I was doing this by Oracle Forms and DDE package. Here is an example of a sample procedure in WHEN-BUTTON-PRESSED event which export data from oracle table to excel:
DECLARE
appid PLS_INTEGER;
convid PLS_INTEGER;
docid PLS_INTEGER;
i number;
j number;
rowcol varchar2(10);
rowcol1 varchar2(10);
str varchar2(4000);
filename varchar2(400);
BEGIN
go_block('MY_BLOCK');
First_Record;
APPID := DDE.APP_BEGIN('C:\Program Files\Microsoft Office\Office\excel.exe', DDE.APP_MODE_MAXIMIZED);
WHILE NOT conv_established LOOP
BEGIN
convid := DDE.INITIATE('excel', 'system');
conv_established := TRUE;
EXCEPTION
WHEN DDE.DMLERR_NO_CONV_ESTABLI
conv_established := FALSE;
END; -- loop
END LOOP;
DDE.EXECUTE(convid, '[Open("C:\LOCATION_OF_XLS
docid := DDE.INITIATE('excel', 'C:\LOCATION_OF_XLS_FILE.x
i :=2;
while :MY_BLOCK.field1_from_my_b
j := 1;
If :MY_BLOCK.field_you_want_t
str := ' -';
Else
str := :MY_BLOCK.field_you_want_t
End if;
rowcol1 := 'R1C' || to_char(j);
DDE.POKE(docid, rowcol1, 'name_of_field', DDE.CF_TEXT, 50000);
rowcol := 'R' || to_char(i) || 'C' || to_char(j);
DDE.POKE(docid, rowcol, str, DDE.CF_TEXT, 50000);
j := j + 1;
.
. here you should put all the fields you want to insert in excel
.
j := j + 1;
i := i + 1;
next_record;
end loop;
filename := 'C:\Sifarnici\Poziv_izvjes
DDE.EXECUTE(convid, '[Save.As("' || filename || '")]', 150000);
DDE.TERMINATE(docid);
DDE.TERMINATE(convid);
DDE.APP_END(APPID);
/* Handle exceptions */
EXCEPTION
WHEN DDE.DDE_APP_FAILURE THEN
MESSAGE('WINDOWS APPLICATION CANNOT START.');
WHEN DDE.DDE_PARAM_ERR THEN
MESSAGE('A NULL VALUE WAS PASSED TO DDE');
WHEN DDE.DMLERR_NO_CONV_ESTABLI
MESSAGE('DDE CANNOT ESTABLISH A CONVERSATION');
WHEN DDE.DMLERR_NOTPROCESSED THEN
MESSAGE('A TRANSACTION FAILED');
when DDE.DMLERR_DATAACKTIMEOUT then
MESSAGE('Time out!');
/* End of trigger */
END;
The same is inserting from excel to oracle table, I didn't do this but here is the link on page where man does similar work:
http://209.85.135.104/sear
I hope that this will help you.
Main Topics
Browse All Topics





by: jaiganeshsrinivasanPosted on 2007-10-07 at 08:01:30ID: 20030150
assuming that you are using a WEB PAGE...you can do this
1) upload the file to a temp directory in your server...
2) oparse the excel sheet ( you have to know what the excel sheet contains)
3) if the excel contains static columns(with varying data) you can load it into a DATASET / DATATABLE
4) you open a connection to your database...using ORACLE connection string...you can use OLEDB ir OracleClient available for .net3
5) take the value from your datatable and save to to your database table...