Hi All,
I am loading data to a child table from a text file. the text files
also contains data not referenced by parent key. while loading the data
if one row fails to satisfies the constraint everything is getting
rollback..
plz suggest me something.. which will help me to discard the
unsatisfied rows and continue with the rest..
My Query:
LOAD DATA CONCURRENT INFILE
'/remote/srm172/saranya/SOURCECOV/common_shell/output/data/common_shell_ex ec.dat'
INTO TABLE CS_COMMON_SHELL _EXEC_REG FIELDS TERMINATED BY '#'
(reg_id,func_ad dress);
Error Msg:
ERROR 1452 (23000): Cannot add or update a child row: a foreign key
constraint fails (`sourcecov/CS_COMMON_SHELL _EXEC_REG`, CONSTRAINT
`CS_COMMON_SHEL L_EXEC_REG_ibfk _2` FOREIGN KEY (`func_address` )
REFERENCES `CS_COMMON_SHEL L_EXEC` (`func_address` ))
Thanks
Devi. 5 4571
kutty wrote:
Hi All,
I am loading data to a child table from a text file. the text files
also contains data not referenced by parent key. while loading the data
if one row fails to satisfies the constraint everything is getting
rollback..
plz suggest me something.. which will help me to discard the
unsatisfied rows and continue with the rest..
My Query:
LOAD DATA CONCURRENT INFILE
'/remote/srm172/saranya/SOURCECOV/common_shell/output/data/common_shell_ex ec.dat'
INTO TABLE CS_COMMON_SHELL _EXEC_REG FIELDS TERMINATED BY '#'
(reg_id,func_ad dress);
Error Msg:
ERROR 1452 (23000): Cannot add or update a child row: a foreign key
constraint fails (`sourcecov/CS_COMMON_SHELL _EXEC_REG`, CONSTRAINT
`CS_COMMON_SHEL L_EXEC_REG_ibfk _2` FOREIGN KEY (`func_address` )
REFERENCES `CS_COMMON_SHEL L_EXEC` (`func_address` ))
Thanks
Devi.
One approach is to load a temporary table which has no
constraints and then insert from the temporary to the child only
those rows where the foreign key constraint is satisfied.
Advantages are that minimal changes are required to your
existing load program and the insert can be handled with a
simple INSERT INTO child (SELECT * FROM temp WHERE constraints
are met); You may have to play around with the syntax -- I can
never remember if you need that parenthesis and/or an AS before
the SELECT.
HTH
Jerry
Hi Jerry,
Thanx a lot..
but..I am loading a huge volume of data (min 2 GB). Two load operations
might increase the loading time. I dont want that to happen.. is there
any possible way to discard the rows which doent satify the constraint?
Oracle support this. It creates a discard file..
Thanks
Kutty
Jerry Gitomer wrote:
kutty wrote:
Hi All,
I am loading data to a child table from a text file. the text files
also contains data not referenced by parent key. while loading the data
if one row fails to satisfies the constraint everything is getting
rollback..
plz suggest me something.. which will help me to discard the
unsatisfied rows and continue with the rest..
My Query:
LOAD DATA CONCURRENT INFILE
'/remote/srm172/saranya/SOURCECOV/common_shell/output/data/common_shell_ex ec.dat'
INTO TABLE CS_COMMON_SHELL _EXEC_REG FIELDS TERMINATED BY '#'
(reg_id,func_ad dress);
Error Msg:
ERROR 1452 (23000): Cannot add or update a child row: a foreign key
constraint fails (`sourcecov/CS_COMMON_SHELL _EXEC_REG`, CONSTRAINT
`CS_COMMON_SHEL L_EXEC_REG_ibfk _2` FOREIGN KEY (`func_address` )
REFERENCES `CS_COMMON_SHEL L_EXEC` (`func_address` ))
Thanks
Devi.
One approach is to load a temporary table which has no
constraints and then insert from the temporary to the child only
those rows where the foreign key constraint is satisfied.
Advantages are that minimal changes are required to your
existing load program and the insert can be handled with a
simple INSERT INTO child (SELECT * FROM temp WHERE constraints
are met); You may have to play around with the syntax -- I can
never remember if you need that parenthesis and/or an AS before
the SELECT.
HTH
Jerry
On 27 Sep 2006 05:04:45 -0700, in mailing.databas e.mysql "kutty"
<sa*****@gmail. com>
<11************ **********@b28g 2000cwb.googleg roups.comwrote:
>| Hi Jerry, | | Thanx a lot.. | | but..I am loading a huge volume of data (min 2 GB). Two load operations | might increase the loading time.
It might also decrease the load time!
Loading imported data into a non-index, non constrained table is
pretty quick. Then taking that data and only moving the relevant data
is also pretty quick.
Loading imported data into a temp table has the benefits of:
if the import data is corrupted then it is easy to restart the process
without disturbing your live data.
further manipulation of the data can be carried out prior to transfer
to the live tables.
business rules can be applied to the data prior to going live
once the valid data has been processed you can then see what is left
behind and then make a value judgement if this data can be discarded
or incorporated into the live data.
>| I dont want that to happen.. is there | any possible way to discard the rows which doent satify the constraint? | Oracle support this. It creates a discard file.. | | Thanks | Kutty | | Jerry Gitomer wrote: | kutty wrote: | Hi All, | | I am loading data to a child table from a text file. the text files | also contains data not referenced by parent key. while loading the data | if one row fails to satisfies the constraint everything is getting | rollback.. | | plz suggest me something.. which will help me to discard the | unsatisfied rows and continue with the rest.. | | My Query: | LOAD DATA CONCURRENT INFILE | '/remote/srm172/saranya/SOURCECOV/common_shell/output/data/common_shell_ex ec.dat' | INTO TABLE CS_COMMON_SHELL _EXEC_REG FIELDS TERMINATED BY '#' | (reg_id,func_ad dress); | | Error Msg: | ERROR 1452 (23000): Cannot add or update a child row: a foreign key | constraint fails (`sourcecov/CS_COMMON_SHELL _EXEC_REG`, CONSTRAINT | `CS_COMMON_SHEL L_EXEC_REG_ibfk _2` FOREIGN KEY (`func_address` ) | REFERENCES `CS_COMMON_SHEL L_EXEC` (`func_address` )) | | Thanks | Devi. | | One approach is to load a temporary table which has no | constraints and then insert from the temporary to the child only | those rows where the foreign key constraint is satisfied. | > | Advantages are that minimal changes are required to your | existing load program and the insert can be handled with a | simple INSERT INTO child (SELECT * FROM temp WHERE constraints | are met); You may have to play around with the syntax -- I can | never remember if you need that parenthesis and/or an AS before | the SELECT. | > | HTH | Jerry
--------------------------------------------------------------- jn******@yourpa ntsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Hi
Thanks Jerry and Jeff for your valuable suggestion. I will try this
approach.
Thanks
Kutty.
Jeff North wrote:
On 27 Sep 2006 05:04:45 -0700, in mailing.databas e.mysql "kutty"
<sa*****@gmail. com>
<11************ **********@b28g 2000cwb.googleg roups.comwrote:
| Hi Jerry,
|
| Thanx a lot..
|
| but..I am loading a huge volume of data (min 2 GB). Two load operations
| might increase the loading time.
It might also decrease the load time!
Loading imported data into a non-index, non constrained table is
pretty quick. Then taking that data and only moving the relevant data
is also pretty quick.
Loading imported data into a temp table has the benefits of:
if the import data is corrupted then it is easy to restart the process
without disturbing your live data.
further manipulation of the data can be carried out prior to transfer
to the live tables.
business rules can be applied to the data prior to going live
once the valid data has been processed you can then see what is left
behind and then make a value judgement if this data can be discarded
or incorporated into the live data.
| I dont want that to happen.. is there
| any possible way to discard the rows which doent satify the constraint?
| Oracle support this. It creates a discard file..
|
| Thanks
| Kutty
|
| Jerry Gitomer wrote:
| kutty wrote:
| Hi All,
|
| I am loading data to a child table from a text file. the text files
| also contains data not referenced by parent key. while loading the data
| if one row fails to satisfies the constraint everything is getting
| rollback..
|
| plz suggest me something.. which will help me to discard the
| unsatisfied rows and continue with the rest..
|
| My Query:
| LOAD DATA CONCURRENT INFILE
| '/remote/srm172/saranya/SOURCECOV/common_shell/output/data/common_shell_ex ec.dat'
| INTO TABLE CS_COMMON_SHELL _EXEC_REG FIELDS TERMINATED BY '#'
| (reg_id,func_ad dress);
|
| Error Msg:
| ERROR 1452 (23000): Cannot add or update a child row: a foreign key
| constraint fails (`sourcecov/CS_COMMON_SHELL _EXEC_REG`, CONSTRAINT
| `CS_COMMON_SHEL L_EXEC_REG_ibfk _2` FOREIGN KEY (`func_address` )
| REFERENCES `CS_COMMON_SHEL L_EXEC` (`func_address` ))
|
| Thanks
| Devi.
|
| One approach is to load a temporary table which has no
| constraints and then insert from the temporary to the child only
| those rows where the foreign key constraint is satisfied.
| >
| Advantages are that minimal changes are required to your
| existing load program and the insert can be handled with a
| simple INSERT INTO child (SELECT * FROM temp WHERE constraints
| are met); You may have to play around with the syntax -- I can
| never remember if you need that parenthesis and/or an AS before
| the SELECT.
| >
| HTH
| Jerry
--------------------------------------------------------------- jn******@yourpa ntsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Hi All,
This is not working for me..
This approach is fine for smaller tables.But if i try to insert data
from the temporary table to the child table
Error occurs:
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting
transaction
can any one suggest me a solution?
Thanks
Kutty
kutty wrote:
Hi
Thanks Jerry and Jeff for your valuable suggestion. I will try this
approach.
Thanks
Kutty.
Jeff North wrote:
On 27 Sep 2006 05:04:45 -0700, in mailing.databas e.mysql "kutty"
<sa*****@gmail. com>
<11************ **********@b28g 2000cwb.googleg roups.comwrote:
>| Hi Jerry,
>|
>| Thanx a lot..
>|
>| but..I am loading a huge volume of data (min 2 GB). Two load operations
>| might increase the loading time.
It might also decrease the load time!
Loading imported data into a non-index, non constrained table is
pretty quick. Then taking that data and only moving the relevant data
is also pretty quick.
Loading imported data into a temp table has the benefits of:
if the import data is corrupted then it is easy to restart the process
without disturbing your live data.
further manipulation of the data can be carried out prior to transfer
to the live tables.
business rules can be applied to the data prior to going live
once the valid data has been processed you can then see what is left
behind and then make a value judgement if this data can be discarded
or incorporated into the live data.
>| I dont want that to happen.. is there
>| any possible way to discard the rows which doent satify the constraint?
>| Oracle support this. It creates a discard file..
>|
>| Thanks
>| Kutty
>|
>| Jerry Gitomer wrote:
>| kutty wrote:
>| Hi All,
>|
>| I am loading data to a child table from a text file. the text files
>| also contains data not referenced by parent key. while loading the data
>| if one row fails to satisfies the constraint everything is getting
>| rollback..
>|
>| plz suggest me something.. which will help me to discard the
>| unsatisfied rows and continue with the rest..
>|
>| My Query:
>| LOAD DATA CONCURRENT INFILE
>| '/remote/srm172/saranya/SOURCECOV/common_shell/output/data/common_shell_ex ec.dat'
>| INTO TABLE CS_COMMON_SHELL _EXEC_REG FIELDS TERMINATED BY '#'
>| (reg_id,func_ad dress);
>|
>| Error Msg:
>| ERROR 1452 (23000): Cannot add or update a child row: a foreign key
>| constraint fails (`sourcecov/CS_COMMON_SHELL _EXEC_REG`, CONSTRAINT
>| `CS_COMMON_SHEL L_EXEC_REG_ibfk _2` FOREIGN KEY (`func_address` )
>| REFERENCES `CS_COMMON_SHEL L_EXEC` (`func_address` ))
>|
>| Thanks
>| Devi.
>|
>| One approach is to load a temporary table which has no
>| constraints and then insert from the temporary to the child only
>| those rows where the foreign key constraint is satisfied.
>| >
>| Advantages are that minimal changes are required to your
>| existing load program and the insert can be handled with a
>| simple INSERT INTO child (SELECT * FROM temp WHERE constraints
>| are met); You may have to play around with the syntax -- I can
>| never remember if you need that parenthesis and/or an AS before
>| the SELECT.
>| >
>| HTH
>| Jerry
--------------------------------------------------------------- jn******@yourpa ntsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Phil |
last post by:
I am using MySQL 4.1.1-1.
When I add a "named" foreign key constraint
alter table sb_query_nm_sub_tp
add constraint f1sbquerynmsubtp foreign key (query_nm) references
sb_query_class (query_nm);
And then do a show create table:
|
by: Robert Brown |
last post by:
Let's say I have a type hierarchy: (just an example)
the general entity customer:
CREATE TABLE customer(customer_id int, customer_name varchar(250),
customer_type int)
three specific customer subtypes: 1 - business, 2 - home, 3 -
university
|
by: Justin |
last post by:
Hi,
In the process of localizing the 'regions' table, we added three new
tables. The localized data will be stored in the TokenKeys and
TokenValues tables. It would be easier if we did away with the
TokeyKeys/TokenValues tables and just added a localeid in the regions
table, but this is the desired schema by the client. Here's the
schema:
Table: regions
|
by: adammitchell |
last post by:
How can you indicate that a FOREIGN KEY constraint references two
columns in two different tables?
"SQL Server Books Online" show an example of how to reference two
columns in the SAME table:
REFERENCES ref_table )
Here is the error and the 'bad' SQL code:
Server: Msg 8148, Level 16, State 1, Line 4
|
by: Jeremy Chapman |
last post by:
Populating a typed dataset from xml document:
I created an xml schema (attached below), generated a typed dataset from it,
and then programatically I tried to populate the typed dataset by calling
its ReadXml method. I keep getting a constraint exception. I have
validated that my xml matches the schema using xmlspy.
I've included the schema, xml, code and exception information below. I
can't figure out why I would get the exception...
| |
by: Christopher Weaver |
last post by:
I'm trying to insert a new Row within an existing Table within an existing
DataSet using the following:
DataRow NewTaskRow = dsTaskActivities.Tables.NewRow();
dsTaskActivities.Tables.Rows.Add(NewTaskRow);
I'm using the code from the help text to remove the constraints within
dsTaskActivities before executing the Add
public static void ClearConstraints(DataSet ds)
|
by: Kevin Chambers |
last post by:
Hi all--
In an attempt to commit an Access MDB to a versioning system (subversion),
I'm trying to figure out how to convert a jet table's metadata to text, a
la SaveAsText. The end goal is to be able to build an MDB completely from
the svn repository text files.
Has anybody dealt with this?
Thanks in advance,
|
by: Jon Maz |
last post by:
Hi,
I have a MySql problem I hope someone can help me with. I'm trying to run
an update on a linking table, the update is running into a Primary Key
constraint violation, and in my workaround I've got stuck trying to write a
DELETE statement.
Here's the table I'm working on:
CREATE TABLE `articles_categories` (
|
by: Ivan |
last post by:
Hello to all and thanks for answer to my topics.
I made one stored procedure that delete one table, but when
call/execute the procedure this show
SQL0532N A parent row cannot be deleted because the relationship
"TXN_TRANSACTION.FK_SCLI " restricts the deletion.
Then in the procedure it adds one delete of the foreign keys. This it
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |