Import Excel File Data into oracle database table.
HI,
i want to insert data into a specific table from a excel file. please help me..
for example
emp.xls file's data need to be import in emp database table.
thanks in advance...
Hi,
to all knowledgable person, this would be gald for u all that i have solved the problem.
through this procedure..
PROCEDURE IMPORT_FROM_EXCEL_PROC (as_FileName VARCHAR2, exe_name varchar2) IS
appid PLS_INTEGER;
convid PLS_INTEGER;
docid PLS_INTEGER;
conv_established BOOLEAN := FALSE;
buffer VARCHAR2(100);
Emp_code VARCHAR2(100);
Emp_name VARCHAR2(100);
Emp_desig VARCHAR2(100);
Emp_Salary VARCHAR2(100);
ls_error VARCHAR2(1000);
li_row integer;
li_col integer;
li_error_count integer;
li_load_count integer;
BEGIN
--Start Excel
--This line assumes that Excel is in the specified directory
-- APPID := DDE.APP_BEGIN('D:\OFFICE11\EXCEL.EXE',DDE.APP_MODE_MINIMIZED);
APPID := DDE.APP_BEGIN(exe_name,DDE.APP_MODE_MINIMIZED);
--Establish a conversation with Excel
--The following loop will not end until a conversation with Excel
--has been established. Therefore, it can result in a endless loop,
--so use with caution.
WHILE NOT conv_established LOOP
BEGIN
convid := DDE.INITIATE('excel', 'system');
conv_established := TRUE;
EXCEPTION
WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN
conv_established := FALSE;
END;
END LOOP;
--Open Excel document
--This assumes that you have an Excel spreadsheet named ddetest.xls in the root of c:
DDE.EXECUTE(convid, '[Open("'||as_FileName||'")]', 10000);
--Initiate conversation with Excel document
docid := DDE.INITIATE('excel',as_FileName);
--Begin transfer from Excel to Forms
li_load_count := 0;
li_error_count := 0;
li_col := 1;
li_row := 2;
GO_BLOCK('IMPORT_XLS');
DDE.REQUEST (docid, 'R' || TO_CHAR(li_row) || 'C' || TO_CHAR(li_col), buffer, DDE.CF_TEXT, 1000);
WHILE length(buffer) > 2 LOOP
WHILE li_col < 5 LOOP
buffer := substr(buffer, 1, instr(buffer, chr(10)) - 2);
IF li_col = 1 THEN --Emp_code
Emp_code := buffer;
ELSIF li_col = 2 THEN --Emp_name
Emp_name := buffer;
ELSIF li_col = 3 THEN --Emp_desig
Emp_desig := buffer;
ELSE --Emp_salary
Emp_salary := buffer;
END IF;
IF nvl(ls_error,'N') = 'N' THEN
li_col := li_col + 1;
DDE.REQUEST (docid, 'R' || TO_CHAR(li_row) || 'C' || TO_CHAR(li_col), buffer, DDE.CF_TEXT, 1000);
ELSE
li_col := 5;
END IF;
END LOOP;
IF nvl(ls_error, 'N') = 'N' THEN
li_load_count := li_load_count + 1;
IF li_load_count = 1 THEN
FIRST_RECORD;
ELSE
NEXT_RECORD;
END IF;
:IMPORT_XLS.Emp_code := Emp_code;
:IMPORT_XLS.Emp_name := Emp_name;
:IMPORT_XLS.Emp_desig := Emp_desig;
:IMPORT_XLS.Emp_salary := Emp_salary;
ELSE
li_error_count := li_error_count + 1;
DDE.POKE(docid, 'R' || TO_CHAR(li_row) || 'C5', ls_error, DDE.CF_TEXT, 10000);
END IF;
ls_error := '';
Emp_code := '';
Emp_name := '';
Emp_desig := '';
Emp_salary := '';
li_col := 1;
li_row := li_row + 1;
DDE.REQUEST (docid, 'R' || TO_CHAR(li_row) || 'C' || TO_CHAR(li_col), buffer, DDE.CF_TEXT, 1000);
END LOOP;
IF li_error_count > 0 THEN
DDE.EXECUTE(convid, '[[save]]', 10000);
Message(TO_CHAR(li_load_count) || ' Record(s) Loaded. ' ||
TO_CHAR(li_error_count) || ' Invalid Record(s). See error in excel file.');
ELSE
Message(TO_CHAR(li_load_count) || ' Record(s) Successfully Loaded.');
END IF;
--End transfer to Excel
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_ESTABLISHED THEN
MESSAGE('DDE CANNOT ESTABLISH A CONVERSATION');
WHEN DDE.DMLERR_NOTPROCESSED THEN
MESSAGE('A TRANSACTION FAILED');
END;
Similar Messages
-
How to load text file data to Oracle Database table?
By using Oracle Forms, how to load text file data to Oracle Database table?
Metalink note 33247.1 explains how to use text_io as suggested by Robin to read the file into a Multi-Row block. However, that article was written for forms 4.5 and uses CREATE_RECORD in a loop. There was another article, 91513.1 describing the more elegant method of 'querying' the file into the block by transactional triggers. Unfortunately this more recent article has disappeared without trace and Oracle deny its existence. I know it existed as I have a printed copy in front of me, and very useful it is too.
-
How to import .dbf file data in oracle 9i table?
I have tele.dbf file. I want to import it into oracle 9i. Is there any tool to import this dbf into oracle with structure.
thanks.
RahulProblem is not clear!, What is this .dbf file is ?
Was that a part of the database before and if so then which is the tablespace its associated with ?( if its part of database and exported the metadata then go through the Bhupinder's suggn.)
or
You have binary or text data within it. ?
or
You mean its some external file like .doc or .xls and u want load that into Bfile or blob column of a table...?
Simply just having extention as .dbf oracle will not accept it by anymeans..
cheers -
Regarding loading of excel data into oracle database
hello,
Can someone help me in knowing that how can we load excel sheets data into oracle database.
I will be really thankful to you.
GursimranHi,
There is tool given by oracle "Oracle Bulk Loader "
you can use this.
But in order use this you need a control file, which specifies how data should be loaded into the database; and a data file, which specifies what data should be loaded.
Example :- this is the control file which has information how the data is processed.
LOAD DATA
INFILE test.dat
INTO TABLE test
FIELDS TERMINATED BY '|'
(i, s)
Example :- test.dat which is the data file or say your excel sheet or document
(1, 'foo')
(2, 'bar')
(3, ' baz')
example of Loading :-
sqlldr <yourName> control=<ctlFile> log=<logFile> bad=<badFile>
sqlldr testing control=test.ctl log=test.log
Thanks
Pavan Kumar N -
Read data from Excel and write into oracle database
Hi
I want to know how can i read data from excel and write into oracle database using java.Kindly help me out to find a solution.
Thanks and Regards
NeetaHai,
I am suggesting the solution.
I will try out and let u know soon.
Make a coma separated file from your excel file.
Assuming that your requirement allows to make a csv file.
This file may be passed as an file object to be read by java.Using JDBC you must be able to populate the data base.You can also use String Tokenizer if needed.
You do not want to go via sql Loader?
For reading the excel file itself do you want java? -
Need help to upload Excel Chinese data into Oracle
Hello
I am very new at internationalization. We are writing an application that
reads Chinese data from a Microsoft Excel file and writes it out into Oracle
8i. This is what we have done:
1. Use JDBC-ODBC driver to read the Excel data directly from .xls.
2. Write data into oracle database.
When we open Excel, we can view the Chinese characters. When we use SQL
PLus, we see only ????. When we write another servlet to retrieve the data,
it is displayed as ????. The few questions I have are:
1. How can I verify that the Chinese data has been accurately inserted into
the database?
2. Do I need to set anything special (environment variables, config files
etc) in BEA Weblogic 5.1 and Oracle 8i?
The environment we have are:
1. BEA Weblogic SP9 running on WIn NT.
2. Oracle 8i running on Solaris.
ThanksMake sure that the characters are correct in the app server after you get
them out of Oracle and before you put them into the web page. This will help
you determine if the problem is in the JDBC access to Oracle or the encoding
into the web page. Make sure that you verify that the hex values of each
character from the db test case are what you expect.
Peace,
Cameron Purdy
Tangosol Inc.
<< Tangosol Server: How Weblogic applications are customized >>
<< Download now from http://www.tangosol.com/download.jsp >>
"Bernard Ong" <[email protected]> wrote in message
news:[email protected]...
Hi Kev
1. "It doesn't work" means that I still see ??? in the database. WHen I
retrieve the data, it is still displayed as ??? in a browser.
2. Codeset to use to display should be UTF-8.
3. Charset in database server is UTF8. I did a "select * from
database_parameters" to get this value.
4. I copied the Chinese characters from Excel and pasted on Notepad. Icould
see the Chinese characters with the Chinese emulator turned on. WHen Icopy
??? from SQL*Plus and paste it into notepad, I see ???.
Presume:
1. Yes, running SQL*PLUS on BEA machine.
2. BEA machine running on WIndows 200 professional. We downloaded aChinese
emulator. WIndows 2000 is the English version.
Cheers
"Kevin Lu" <[email protected]> wrote in message
news:[email protected]...
Hi Bernard,
Please first clarify:-
1) "It doesn't work" means... cannot display the chinese character as
you
desired?
2) Which codeset that you want it to display, Chinese traditional big5?UTF-8,
i would think it's still in Java/JDBC codeset.
3) What's the charset in the database server? Get help from DBA if you
not
sure
how to obtain this information.
4) Try paste the result(select via SQL*Plus) onto Win Notepad, what's
the
outcome?
Presume:
1) you're running SQL*Plus on your BEA machine?
2) BEA machine is running on Chinese O/S or hv NJStar installed andrunning?
Let me know if i could be of further help.
-Kev
"Bernard Ong" <[email protected]> wrote:
Thanks Kev.
We had changed the registry in the BEA machine to
AMERICAN_AMERICA.UTF8.
THis was done for the Oracle registry in the BEA machine.
Unfortunately,
it
still doesn't work.
Cheers,
Bernard
"Kevin Lu" <[email protected]> wrote in message
news:[email protected]...
Hi Bernard,
I take about the same approach as you while resolving codeset
problem.
So,
first
i make sure SQL*Plus could display my desired result before proceedto
application(be
it Swing, servlet, JSP console etc..). You may try set the NLS_LANGon
your client
machine(same machine as where you run SQL*Plus) to the SAME as
database
server
character set, for instance America_American.US7ASCII. You should
able
to
see
the Chinese characters.
Hope this help with your first question. I can't help for the restanyway.
good luck!
-Kev
"Bernard Ong" <[email protected]> wrote:
Hello
I am very new at internationalization. We are writing an
application
that
reads Chinese data from a Microsoft Excel file and writes it outinto
Oracle
8i. This is what we have done:
1. Use JDBC-ODBC driver to read the Excel data directly from .xls.
2. Write data into oracle database.
When we open Excel, we can view the Chinese characters. When we useSQL
PLus, we see only ????. When we write another servlet to retrievethe
data,
it is displayed as ????. The few questions I have are:
1. How can I verify that the Chinese data has been accurately
inserted
into
the database?
2. Do I need to set anything special (environment variables, configfiles
etc) in BEA Weblogic 5.1 and Oracle 8i?
The environment we have are:
1. BEA Weblogic SP9 running on WIn NT.
2. Oracle 8i running on Solaris.
Thanks -
Generate XML file from an Oracle Database Table
Hello All,
I want to generate a xml file from an Oracle Database table which contains a blob column.
Can somebody give pointers on this please.
Thanks in advance
SulakshanaUse the DBMS_XMLGEN package.
-
Import excel/csv data to oracle table problem
hello sir,
i am using application importing csv/excel data to oracle table which is developed by vikas and that i want but when i add csv file and upload. My cvs file will displayed but when i click on create table button then it gives error like ...
1) invalid datatype. vikas link as :
http://htmldb.oracle.com/pls/otn/wwv_flow_custom_auth_std.login_page?p_flow_page=38131:1:1287783765705596
i search in forum for solution i got following link but it also gives me error
Re: File Browse, File Upload
still i am trying but i dont get solution . plz help me!!! give me steps ......
Report on table created
says:
failed to parse SQL query:
ORA-00942: table or view does not existHi
Firstly, are you trying to upload your data into a new table or an existing table? If it's a new table, what name are you using?
Secondly, it may help if we could see a sample of the csv -
How to develope application for converting excel data into oracle database
I am very new to the oracle world. I want to develop application for converting excel sheet into oracle database using oracle forms. I have basic knowldge of oracle but i am totally new to the forms. Can anybody tel me step by step procedure to do this task? Please help me out in this problem.
Thanx in advance.Hello,
just do a "Search" in this forum with words "excell to oracle"... and you could find lot of posts about that, i.e.:
Re: How to load excel-csv file into oracle database
Jose L -
How to store BDC error messages into oracle database table?
Hello Experts,
I have a peculier requirement wherein I need to store the error messages occured while executing the transaction using BDC (Call Transaction Method) in an Oracle Database table format. Is that possible, if yes, how?
Thanks in advance.Hi,
Structure of BDCMSGCOLL.
TCODE -> BDC Transaction code
DYNAME -> Batch input module name
DYNUMB -> Batch input screen number
MSGTYP ->Batch input message type
MSGSPRA -> Language ID of a message
MSGID -> Batch input message ID
MSGNR -> Batch input message number
MSGV1 -> Variable part of a message
MSGV2 -> Variable part of a message
MSGV3 -> Variable part of a message
MSGV4 -> Variable part of a message
FLDNAME -> Field name
Ex :
DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,
BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.
IF SY-SUBRC 0.
PERFORM ERR.
CLEAR I_MSG.
REFRESH I_MSG.
ENDIF.
*& Form ERR
text
--> p1 text
<-- p2 text
form ERR .
DATA V_MSG(255) TYPE C.
READ TABLE I_MSG WITH KEY MSGTYP = 'E'.
IF SY-SUBRC = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = I_MSG-MSGID
LANG = 'E'
NO = I_MSG-MSGNR
V1 = I_MSG-MSGV1
V2 = I_MSG-MSGV2
V3 = I_MSG-MSGV3
V4 = I_MSG-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE V_MSG. " Error Message Displayed Here.
CLEAR V_MSG.
ENDIF.
endform. " ERR
hope this will help you.
Reward if found helpfull,
Cheers,
Chaitanya. -
Load xml data to oracle database table
hi,
i am facing some problem in fetching from xml data into oracle . That if the table column name and xsl and xsd tag are equal then data is fetching .
if we we are changing column name in xsl and xsd then data is not fetching.
the soure is like that
XSD FILE
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
</xs:complexType>
<xs:complexType name="TRANSAC_Type">
<xs:all>
<xs:element name="NECRITUR" type="Char4_Type" minOccurs="0" nillable="false"/>
<xs:element name="NPTF_INT" type="Char2_Type" minOccurs="0" nillable="false"/>
</xs:all>
</xs:complexType>
<xs:simpleType name="Char1_Type">
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
</xs:restriction>
</xs:simpleType>
XSL FILE
<?xml version="1.0" encoding="UTF-8"?>
<xsl:output method="xml" indent="yes"/>
<!-- Treatment of fields for table -->
<xsl:template match="NECRITUR">
<NO_ECRIT_INT>
<xsl:value-of select="."/>
</NO_ECRIT_INT>
</xsl:template>
<xsl:template match="NPTF_INT">
<NPTF_INT>
<xsl:value-of select="."/>
</NPTF_INT>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
Xml file
<File xmlns:xsi="http://www.’’’’’ ">
<Header>
<FileType>TRANSAC</FileType>
<FileName>TRANSAC.XML</FileName>
<CreationDate>2007-02-22</CreationDate>
<CreationTime>14:56:48</CreationTime>
</Header>
<Data>
<TRANSAC>
<NECRITUR>6</NECRITUR>
<NPTF_INT>MMMM</NPTF_INT>
</TRANSAC>
</Data>
</File>
Table Is
REP (NO_ECRIT_INT, NPTF_INT, CreationDate, CreationTime)
Regards
manu
Message was edited by:
user561683Hi Manu
Im not quite sure what your question is?
Are you trying to load data to the database or
Are you trying to retrieve data from the database ?
Either way this forum is meant for XML Publisher or BI Publisher issues not just XSL ... you might be better asking on the XML forum.
Regards, Tim -
Problems with special characters uploading data into oracle database
Greetings
I have a problem uploading data into oracle tables from sybase datasource. The data that I want to upload is in Spanish, for example when I have a varchar field with the data 'Consultoría', in oracle table the data upload with interrogation symbols.
I have my source and target datastores configured as follows.
Any suggestion? Thank you for your timeChack section 10 Locales and Multi-byte Functionality in the SAP Data Services Reference Guide for an exhaustive description of NLS settings.
As a summary, following settings are required:
locales in the datastore definitions match the actual locale used in the associated databases
the locale of the DS engine allows for source to target translation
the character set in the target database supports storage of accented characters -
Insert data into oracle database using a PHP form
I'm trying to enter data into my oracle database table using a php form. When I click submit no data is added. Could someone help me please. I'm new to php/oracle thing.
NOTE: I don't have any problem connecting to the database using php.
Here is the code I'm using:
<?php
// just print form asking for name if none was entered
if( !isset($query)) {
echo "<form action=\"$uri\" method=post>\n";
echo "<p>Enter Name: ";
echo "<input type=text size=100 maxlength=200 name=data value=\"$data\">\n";
echo "<br><input type=submit name=submit value=Submit>\n";
echo "</form>\n";
exit;
// insert client's name
$query = "INSERT INTO client (name) VALUES ($data)";
// connect to Oracle
$username = "xxxx";
$paswd = "yyyyyy";
$dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
"(HOST=patriot.gmu.edu)(PORT=1521))".
"(CONNECT_DATA=(SID=COSC)))";
$db_conn = ocilogon($username, $paswd, $dbstring);
$stmt = OCIParse($db_conn, $query);
OCIExecute($stmt, OCI_DEFAULT);
OCIFreeStatement($stmt);
OCILogoff($db_conn);
?>
Thanks for your help. I will also appreciate a better was to do it.
Tonyresumption and jer,
Sorry I cannot format the code for easy reading!
The page is submitting to itself. See action = \"$uri\". I used the same logic to enter SELECT querries into the database. It pulls and displays data back on the webpage. The code I used for this is below. Compare it with the one above for inserting data into the table.
<?php
// connect to oracle
$username = "xxxxx";
$paswd = "yyyyy";
$dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
"(HOST=patriot.gmu.edu)(PORT=1521))".
"(CONNECT_DATA=(SID=COSC)))";
$db_conn = ocilogon($username, $paswd, $dbstring);
// username and password will be unset if they weren't passed,
// or if they were wrong
if( !isset($query)) {
// just print form asking for account details
echo "<form action=\"$uri\" method=post>\n";
echo "<p>Enter Query: ";
echo "<input type=text size=100 maxlength=200 name=query value=\"$query\">\n";
echo "<br><input type=submit name=submit value=Submit>\n";
echo "</form>\n";
exit;
// remove unwanted slashes from the query
$query = stripslashes($query);
// run the query
$stmt = OCIParse($db_conn, $query);
OCIExecute($stmt, OCI_DEFAULT);
// Open the HTML table.
print '<table border="1" cellspacing="0" cellpadding="3">';
// Read fetched headers.
print '<tr>';
for ($i = 1;$i <= ocinumcols($stmt);$i++)
print '<td class="e">'.ocicolumnname($stmt,$i).'</td>';
print '</tr>';
// Read fetched data.
while (ocifetch($stmt))
// Print open and close HTML row tags and columns data.
print '<tr>';
for ($i = 1;$i <= ocinumcols($stmt);$i++)
print '<td class="v">'.ociresult($stmt,$i).'</td>';
print '</tr>';
// Close the HTML table.
print '</table>';
OCIFreeStatement($stmt);
OCILogoff($db_conn);
?> -
I can not import the mvdemo.dmp into oracle database
I have download mapviewer from oracle ,but i can not import the demo data of mvdemo.dmp into oracle database ,it just report the character set problem can not transfer. i am using oracle 9i resease Chinese edition,may smoe friend tell me the how to solve problem. thanks a lot.and which character character set of mvdemo.dmp has used.
Drag the photos to the iPhoto icon on the dock. Then wait for the fix that will hopefully come in 10.8.3
-
Insert data into a database table from a string
Hi,
I am need to insert data into a table from the text file. I pull the data into an internal table using GUI_UPLoad. I read the data into an internal table and concatenate data into a string. I need to do this because the structure of the table is dynamic. it is used to upload a series of tables each with different structure, But the data is stored in the string v_tabledata. How to do that.
after uploading the data from the textt file into a table
oop at i_final.
v_tabname = i_final-table_name.
concatenate i_final-table_rec1 i_final-table_rec2 i_final-table_rec3
i_final-table_rec4 i_final-table_rec5 into v_tabledata.
from 'v_table data' i need to upload the data into a table and the structue of the table is known dynamically. Any thoughts using field symbols?
Thanks,
VGLet me see if I've understood your issue
You have a file to be uploaded into an internal table but this file has many different layouts and then you don't know how to link these fields with the internal table...is it your issue?
Then you've read the internal table, you've sent it to a string divided by space or something else and then are you trying to read this string to send it to a table?
We could read the standard tables which maintain the program names, table names etc... (DD* tables, as the DD03L table) and then create some rules...
We could create a parameter table to read your file/table dynamically...
Please, try to rewrite in other words your problem...because there are a lot of ways to achieve your issue...
Alexandre Mendes
Maybe you are looking for
-
Problem with AIR Bundled Distribution on Windows 7 (Error #5100)
We've just finished an application and have set up the bundled distribution for the Installation of AIR and the Application. It works fine on Windows XP, Vista, and too on MAC OS X. On Windows 7 however, it doesn't install. It loads the installer, an
-
Test/Trial project on MDM and XI integration.
Test/Trial project on MDM and XI integration. I want to try out a test case scenario where in i would be importing and exporting data to XI (Using XML files i guess) I am a newbie in MDM integration. Please help me out with my trial project. What i a
-
I cant connect my ipad 2 to the wifi unless right next to the router
i cant connect my ipad 2 to the wifi unless right next to the router
-
Function module to find out DATA BASE size, free space, used size
Is there any function module to find out DATA BASE , free space, used size FM that gives all the details of the Date base what data base, what is the size, free space, used space etc... instead of writing case by case for each data base. based on CA
-
QM02 (mail to vendor when clicking on Print Preview)
Hi Expert, When user click on Print Preview(QM02-Notification-Print-Notifiaction ,enter email address in QM02 transaction.it shoots a mail to specified address. After EHP4 upgradation its not working. What may be the reason,