Importing data into an existing table from excel problem
Hopefully I am posting this in the right place..
I am having trouble importing data from Excel into an oracle table using the 'import data' wizard in SQL developer.
The problem is that the I want to import data into a table which all ready has data and I want the new data to be imported into the first row of the table not in a new row at the end of the table.
This is probably best shown by example:
create table todelete (
site_no varchar2(2),
data1 number,
qa number);
insert into todelete values ('w1',1,null);
insert into todelete values ('w1',2, null);
insert into todelete values ('w1',3,null);
Now I want to import the following data from excel into the QA column starting at w1:
SITE_NO
QA
w1
4
w2
4
w3
4
However, when I import the QA column it goes into a new row:
SITE_NO
DATA1
QA
w1
1
NULL
w2
2
NULL
w3
3
NULL
NULL
NULL
4
NULL
NULL
4
NULL
NULL
4
The problem is that the I want to import data into a table which all ready has data and I want the new data to be imported into the first row of the table not in a new row at the end of the table.
No - the PROBLEM is that a table does NOT have a 'first' row or a 'row at the end of the table'.
Rows in a table are like balls in a basket; there is NO 'first' ball.
As already suggested please mark this thread ANSWERED and repost it in the sql developer forum where it belongs.
Similar Messages
-
How to import data into a Z table from excel file?
hi,
i have a custom created Z table into which i want to import some data from an excel file. which function can i use to do so because SE16 allows me to insert data only one by one via a data entry screen. this is time consuming. i want to import data from excel file so that its faster.HI,
this program uploads data from excel and modifies ztable,(inserts records into ztable), check this and modify according to ur requirement)
This program uploads material number from excel sheet and does
******modifications to material number if required by the user
******and updates the table zmatnr with new material against the old material number
REPORT zmat_no message-id zebg.
TYPE-POOLS truxs.
TABLES:zmatnr.
DATA : itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA row LIKE alsmex_tabline-row.
data : g_matnr like mara-matnr.
data : count type i.
data : itab_count type i.
data : gi_final like zmatnr occurs 0 with header line.
*data : begin of gi_final occurs 0,
mat_old like mara-matnr,
mat_new like mara-matnr,
end of gi_final.
***********************Selection Screen*************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETER : pfname LIKE rlgrap-filename OBLIGATORY.
select-options : records for count.
SELECTION-SCREEN END OF BLOCK b1.
*********************At Selection Screen*************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfname.
PERFORM search.
START-OF-SELECTION.
perform process.
form process.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = pfname
i_begin_col = 1
i_begin_row = 2
i_end_col = 12
i_end_row = 65000
TABLES
intern = itab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
describe table itab lines itab_count.
row = 1.
loop at itab.
if itab-row <> row.
append gi_final.
clear gi_final.
endif.
case itab-col.
when '1'.
CLEAR G_MATNR.
gi_final-OLD_MATNR = itab-value.
CONCATENATE 'NEW' gi_final-old_matnr INTO itab-value.
gi_final-new_MATNR = itab-value.
endcase.
row = itab-row.
append gi_final.
clear gi_final.
endloop.
CALL FUNCTION 'PROGRESS_INDICATOR'
EXPORTING
I_TEXT = 'File Has Been Successfully Uploaded from Workstation ' .
if not gi_final[] is initial.
if not records-low is initial .
if not records-high is initial.
records-high = records-high + 1.
DESCRIBE TABLE gi_final LINES count.
IF records-high < count.
DELETE gi_final FROM records-high TO count.
ENDIF.
IF records-low <> 1.
IF records-low <> 0.
DELETE gi_final FROM 1 TO records-low.
ENDIF.
ENDIF.
endif.
endif.
endif.
IF NOT GI_FINAL[] IS INITIAL.
CALL FUNCTION 'PROGRESS_INDICATOR'
EXPORTING
I_TEXT = 'Processing zmatnr table'
I_OUTPUT_IMMEDIATELY = 'X'.
if itab_count <> count.
message i000 with 'records are not matching'.
exit.
else.
modify zmatnr from table gi_final.
message i000 with 'data base table modified successfully'.
endif.
endif.
endform.
*& Form search
text
--> p1 text
<-- p2 text
FORM search .
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
CHANGING
file_name = pfname.
ENDFORM. " search
regards
siva -
Is it possible to import data into an existing table?
Hi.. everyone.
Is it possible to import data into an existing table
by using import utility?
The exported table and the existing table have the same name
and table schema.
I want to append "new data(exported from oracle8.0.5)" to
"an existing partitioned-table" by using "oracle 9i import utility".
Thanks in advance.
Have a nice day.
Ho.SQL> select index_name
2 from user_indexes
3 where table_name = 'IMPORTPK';
INDEX_NAME
SYS_C007610
SQL> create view importpk_view as select * from importpk;
View created.
SQL> disconn
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options
SQL> exit
C:\>exp userid=oracle/oracle tables=importpk
Export: Release 10.1.0.2.0 - Production on Tue Sep 5 08:30:50 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table IMPORTPK 10 rows exported
Export terminated successfully without warnings.
C:\>imp userid=oracle/oracle tables=importpk ignore=y
Import: Release 10.1.0.2.0 - Production on Tue Sep 5 08:31:12 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.01.00 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
. importing ORACLE's objects into ORACLE
. . importing table "IMPORTPK"
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (ORACLE.SYS_C007610) violated
Column 1 1
Import terminated successfully with warnings.
C:\>sqlplus/nolog
SQL*Plus: Release 10.1.0.2.0 - Production on Tue Sep 5 08:33:20 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
1.No
Note : if table content primary key and index.
SQL> conn oracle/oracle
Connected.
SQL> create table withoutcons ( no number);
Table created.
SQL> insert into withoutcons select * from importpk;
10 rows created.
SQL> create view withoutcons_view as select * from withoutcons;
View created.
SQL> disconn
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options
SQL> exit
C:\>exp userid=oracle/oracle tables=withoutcons
Export: Release 10.1.0.2.0 - Production on Tue Sep 5 08:36:05 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table WITHOUTCONS 10 rows exported
Export terminated successfully without warnings.
C:\>imp userid=oracle/oracle tables=withoutcons ignore=y
Import: Release 10.1.0.2.0 - Production on Tue Sep 5 08:37:17 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.01.00 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
. importing ORACLE's objects into ORACLE
. . importing table "WITHOUTCONS" 10 rows imported
Import terminated successfully without warnings.
2. Yes
If table content no unique constraints
Message was edited by:
user526020 -
Importing Data into Sql Server 2012 from Excel Data
Hi,
I got errors like this when i am doing import data into sql server from excel Data. Can you please help us?
- Executing (Error)
Messages
Error 0xc020901c: Data Flow Task 1: There was an error with Source - demotable$.Outputs[Excel Source Output].Columns[Comment] on Source - demotable$.Outputs[Excel Source Output]. The column status returned was: "Text was truncated or one
or more characters had no match in the target code page.".
(SQL Server Import and Export Wizard)
Error 0xc020902a: Data Flow Task 1: The "Source - demotable$.Outputs[Excel Source Output].Columns[Comment]" failed because truncation occurred, and the truncation row disposition on "Source - demotable$.Outputs[Excel Source Output].Columns[Comment]"
specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - demotable$ returned error code 0xC020902A. The component returned a failure code when the pipeline engine called PrimeOutput().
The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)Are you attempting to import into a newly made table or into an existing table? It looks like it's trying to insert data where it cannot be inserted (invalid column or lack of data size in your column).
Try the following:
1). In your excel sheet, highlight the whole sheet and make sure the cells are in 'text' form and try re-importing
2). save the document as ms dos TEXT and import as a text document.
3). double check your columns are correct for the data, for example if you have a column that has a string of 100 characters and your column is 'NvarChar(90)' - that might cause the error? Or just correct data type in your column
3). If that doesn't work and you're inserting into a new table, try importing it as string first and writing a query to insert columns that should be float/integer or whatever. You may want to convert float texts to a 'bigint' first rather than string
> float as that can cause problems if I remember correctly. -
How to update (add new data in different tab) existing table from Excel
i've an existing table, for instance User Profile table, it consists of few tab in the table which contains different data... recently i've added new tab to the existing table and i would like to upload a particular data for this new tab... is there any way to upload (insert new data for the tab on existing data) this particular data into the existing table from Excel file?
could it be done by using lsmw?
Edited by: Yeong Kang Liew on Apr 5, 2010 4:35 AMCheck HELP on MODIFY & UPDATE statements.
-
Sql/Plsql code to export data into a temporary table from a text file
Dear all,
I need to create a temporary table getting data from a text file. I am very new to data loading could you please help me how to read the text file in to a temporary table.
i have text file like as below:
order items : books Purchasing
start date:
8-11-09
Notes: Books are selling from aug10 to aug 25
Action performed
Time
Verified By
sold out from shop, sold out date:_________
1.
physics _______ book sold to ravi
2.
social _______ book this is a good book
sold to kiran
aug10th
ronald
3.
maths book to sal
4.
english book__________ this was a newbook
to raj
jak
return to shop, return date:____________
1.
maths book return by:_____________ Verify book
aug11th
john
2.
story book by:_________ checked
aug14th
Now i need to create a temporary table and insert the data into the table from this text file.
Now i need to create a temporary table named as books_order with 5columns(order,Status,Action_Performed,Time,Verified_By) like as below:
Order status Action_Performed Time Verified_By
books Purchasing sold physics _______ book sold to ravi _______ _________
books Purchasing sold social _______ book this is a good book sold to kiran aug10th ronald
books Purchasing sold maths book to sal _____ __________
books Purchasing sold english book__________ this was a newbook to raj __________ jak
books Purchasing return maths book return by:_____________ Verify book aug11th john
books Purchasing return story book by:_________ checked aug14th _________
Thanks in advance.Isn't school work marvelous?
Create an external table.
http://www.morganslibrary.org/reference/externaltab.html
Getting the data into a temporary table may make sense in SQL Server ... but not in Oracle. -
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 -
Import Data/Populate fields in pdf from Excel
I'm not sure if I am using the correct terms, but I would like to set up text fields in a pdf that can import data from specific fields in an excel file. I found the import data form in the properties of the text field, but it will only allow me to select pdf files. Is it possible to import data an excel file to a text field? I would like to do the following
1. create a excel table that includes kids last name, first name, and Grades (Q1, Q2, E1, S1 etc...)
2. I have a pdf form that already has text fields that correspond to the fields mentioned above.
3. Set up the pdf to import the data and generate a page for each student.
I specifically mentioned excel because everyone at my school has excel. However, it would also work if I could design another pdf with a table that I could import data from.Something like this?
// Import the first row of data from "myData.txt".
this.importTextData("/c/desktop/myData.txt", 0)
if (typeof cnt == "undefined") cnt = 0;
this.importTextData("/c/desktop/textdata.txt", cnt++ % 4)
// Specify the name of the template
var template_name = "Student Information Sheet";
// Get a reference to the template
var t = getTemplate(template_name);
// Add a new page based on the template
if (t !== null) {
t.spawn({
nPage: numPages, // Add the new page to end of document
bOverlay: false, // Create a new page, not an overlay
bRename: true // Rename the fields
} else {
app.alert("The template named \'" + template_name + " does not exist in this document.", 1);
But how would I tell the new page to take the second row from the chart, and will I have to click the button for each one of the fields in the data? -
How to insert data into custom database table from an hcsf
i want to insert data into database table that i have created from an hcsf.
example :
say i have created a table in oracle database and i hav created a hcsf file.now i want that when somebody fills in that hcsf and click submit ,i want that entries should be updated in my database table.
plzzz reply ASAP(it's urgent)you'll need a bit of Java code... extract the data during a check-in filter, and insert it into the database.
check out the "DataAccess" component in the HowToComponents for query-running examples, and the "DynamicPrefix" component for a check-in filter example.
I have older copies here:
http://bezzotech.com/library -
To add the multiline data into an internal table from TextEdit
Hello Experts,
I have one requirement that I have to use the TextEdit field. and put the values into an internal table.
can you help me. with some sample code.
Thanks in Advance
KuldeepThe problem is solved by using the following code
DATA: data TYPE REF TO CL_HTMLB_TEXTEDIT.
Data itab1 type itab.
data ?= CL_HTMLB_MANAGER=>GET_DATA(
request = runtime->server->request
name = 'textEdit'
id = 'txt1'
data text type string.
IF data IS NOT INITIAL.
text = data->text.
ENDIF.
SPLIT text AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO
TABLE itab1.
Kuldeep -
Sql/Plsql code to store data into a temporary table from a text file
Dear all,
I need to create a temporary table getting data from a text file. I am very new to data loading could you please help me how to read the text file in to a temporary table.
i have text file like as below:
order* items : books Purchasing
start date:
8-11-09
Notes: Books are selling from aug10 to aug 25
Action performed*
Time*
Verified By*
sold* out from shop, sold out date:_________
+1.+
physics _______ book sold to ravi
+2.+
social _______ book this is a good book
sold to kiran
aug10th
ronald
+3.+
maths book to sal
+4.+
english book__________ this was a newbook
to raj
jak
return* to shop, return date:____________
+1.+
maths book return by:_____________ Verify book
aug11th
john
+2.+
story book by:_________ checked
aug14th
Now i need to create a temporary table with 5columns(order,Status,Action_Performed,Time,Verified_By) like as below:
Now i need to create a temporary table named as books_order with 5columns(order,Status,Action_Performed,Time,Verified_By) like as below:
Order status Action_Performed Time Verified_By
books Purchasing sold physics _______ book sold to ravi _______ _________
books Purchasing sold social _______ book this is a good book sold to kiran aug10th ronald
books Purchasing sold maths book to sal _____ __________
books Purchasing sold english book__________ this was a newbook to raj __________ jak
books Purchasing return maths book return by:_____________ Verify book aug11th john
books Purchasing return story book by:_________ checked aug14th _________
Thanks in advance.Hi,
Thanks for your suggestions. I Was able to get the data using utl_file.get_line. But i was not able to the data if it is in the below format:
I was able to read the data and storing if it is in the same line.But i dont know how to read below data
Book. Type Name Location Ownership Code
Story SL hyd SS-HYD
In this data i have to search for 'Book. type' and then i need to save the word 'Story' to the column 'Book_type'
Then i need to search for 'Name' and i need to save 'SL' into the column into 'Name'
Then i need to search for 'Location' and i need to save 'hyd' into the column into 'Location'
I was able to extract the data if it is in below format using utl_file.get_line
Known Author: Unknown
Less Selling Factors: Thunderstorms
Reason: Unknown
Any one can explain me how to solve the above criteria.
Below i am explaining the same problem in detail.
I have a text file as below and i have a table having 12 columns. Now i need to insert this text file into the table story_books.
CREATE TABLE story_books
book_id NUMBER,
Category VARCHAR2(100 BYTE),
Book_type VARCHAR2(100 BYTE),
Name VARCHAR2(700 BYTE),
Location VARCHAR2(700 BYTE),
Ownership_code VARCHAR2(700 BYTE),
Author VARCHAR2(700 BYTE),
Less_Sel_fact VARCHAR2(700 BYTE),
Reason VARCHAR2(700 BYTE),
Buying VARCHAR2(700 BYTE),
Suspected Book VARCHAR2(700 BYTE),
Conditions VARCHAR2(700 BYTE)
-------------------------text file---------------
Books Out Table: Books
Book. Type Name Location Ownership Code
Story SL hyd SS-HYD
Known Author: Unknown
Less Selling Factors: Thunderstorms
Reason: Unknown
Buying (if applicable):
Not Applicable
Suspected Book:
Unknown
Conditions to increace sales:
Advertisement in all areas
i was able to read the data and storing if it is in the same line.But i dont know how to read below data
Book. Type Name Location Ownership Code
Story SL hyd SS-HYD
In this data i have to search for 'Book. type' and then i need to save the word 'Story' to the column 'Book_type'
Then i need to search for 'Name' and i need to save 'SL' into the column into 'Name'
Then i need to search for 'Location' and i need to save 'hyd' into the column into 'Location'
I was able to extract the data if it is in below format using utl_file.get_line
Known Author: Unknown
Less Selling Factors: Thunderstorms
Reason: Unknown
Any one can explain me how to solve the above criteria.
Thanks in advance. -
Insert Data into a PK Table from a Non-PK Table
Suppose I have a Table A with 10 columns in Schema 1 and there are 100 records in it. Now I create a Table B with the same 10 columns but create 4 columns as Primary Key in another Schema 2. I want to Insert the data from Table A into Table B but the 100 rows of data have duplicate entries of Primary Key and so I get Primary Key constraint violation. I want to know whether I will be able to Insert data by a quey and if so how?
Tried to simulate ur scenario in my environment...check the insert statement...you can implement it to get ur solution.
Here it goes:
SQL> desc testt; <table u want to insert from,this has no pk>
Name Null? Type
DEPTNO NUMBER
JOB VARCHAR2(10)
SQL> desc testt_t;<table to be loaded,table with pk>
Name Null? Type
DEPTNO NOT NULL NUMBER
JOB VARCHAR2(10)
SQL> select * from testt;
DEPTNO JOB
10 aaa
11 bbb
12 ccc
10 aaa
11 bbb
12 ccc
10 aaa
7 rows selected.
SQL> select * from testt_t;
no rows selected
SQL> insert into testt_t (select t1.deptno,t1.job from testt t1 where t1.rowid =(select min(t2.rowid
) from testt t2 where t1.DEPTNO=t2.DEPTNO and t1.JOB=t2.job));
3 rows created.
SQL> -
Field-Symbols: How to retrieve data into an internal table from FS
Hello All,
I am working on field symbols.I have declared the field symbols as shown.
FIELD-SYMBOLS: <gt_pos_data> TYPE table,
<wa_pos_data> like <gt_pos_data>.
Data: Begin of itab occurs 0,
field1(5) type c,
field2(10)_type c,
end of itab.
The FS <gt_pos_data> has 100 fields but I need to move only two fields from this FS to my internal table itab.I am doing the following.
loop at <gt_pos_data> assigning <wa_pos_data>.
itab-field1 = <wa_pos_data>-field1.
itab-field2 = <wa_pos_data>-field2.
append itab.
clear itab.
endloop.
But it is giving me an error saying "<wa_pos_data> is a table without header line and therefore has no componet FIELD1".How to achieve this requirement?
Thanks in advance
Sandeep<wa_pos_data> should be defined LIKE LINE OF <gt_pos_data>, but it will still have no structure, so you need to assign a field symbol to the component as well.
FIELD-SYMBOLS: <gt_pos_data> TYPE table,
<wa_pos_data> like LINE OF <gt_pos_data>,
<field> type any.
Data: Begin of itab occurs 0,
field1(5) type c,
field2(10)_type c,
end of itab.
loop at <gt_pos_data> assigning <wa_pos_data>.
assign componet 'FIELD1' of structure <wa_pos_data> to <field>.
if sy-subrc = 0.
itab-field1 = <field>.
endif.
assign componet 'FIELD2' of structure <wa_pos_data> to <field>.
if sy-subrc = 0.
itab-field2 = <field>.
endif.
append itab.
clear itab.
endloop.
Regards,
Rich Heilman -
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; -
Import data into oracle from a text file?
hi guys,
How can we import data into oracle9i release 1 from a text file with comma seperated or tab seperated delimeters?
please help,
Imrantable is already created, just have to populate data into table through a dat or text file. As suggested, you would either:
1). use SQL*Loader to load the data into this table.
2). create external table on that data file and then do:
INSERT INTO your_real_table
SELECT * FROM that_external_table ;
Maybe you are looking for
-
Oracle 7.3 import to Oracle 8i Enterprise Edition
Due to data file block corruption we had to install Oracle 8i in NT. After successful installation we tried importing 7.3.4 data to 8i, after importing table data it seeems the import process got hung, the CPU usage shows 100% and the application see
-
Rec.acc balance with vendor wise
Hi all, one rec. acc using for many vendors how i can get the report one rec acc balance with vendor wise. thanks!! lakshmi,
-
I thought that I read that they were going to reinstall the ability to sync Calendar and Contact via iTunes. Has anyone heard of them bringing this back?
-
Upgrade to 11.5.9
hi all i still using oracle apps 11i(11.5.7) DB (8i). I want to upgrade to (11.5.9) DB 9i what are the steps required for upgrading?
-
Can I upgrade from Mac OS X Server 10.6.8 to Lion?
I am currenty running a Mac mini with Mac OS X Server 10.6.8 and would like to upgrade to plain Lion OS X, can I do this or will their be problems going from a server OS to the normal OS?