Home » SQL & PL/SQL » SQL & PL/SQL » copying data from table(with no constraints) to table with constraints (Oracle 11g)
copying data from table(with no constraints) to table with constraints [message #557494] Wed, 13 June 2012 06:42 Go to next message
shreeka
Messages: 5
Registered: June 2012
Junior Member
I want to create a store procedure to copy data from a source tables(which may not have any constraints defined) to a table which has primary key, foreign key and unique key constraints.

Any records which are rejected due to these constraints not being satisfied need to go another table.

Once the initial data load is done, these procedures need to be automated(through cron) to do the future incremental uploads in the same manner.

Could anyone please tell me which is the best way to approach this problem?
Re: copying data from table(with no constraints) to table with constraints [message #557495 is a reply to message #557494] Wed, 13 June 2012 06:44 Go to previous messageGo to next message
Michel Cadot
Messages: 54155
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How Oracle will know what are the constraints?

I want to copy myself but taller, stronger, healthier. How can I do it?

Regards
Michel
Re: copying data from table(with no constraints) to table with constraints [message #557500 is a reply to message #557494] Wed, 13 June 2012 06:52 Go to previous messageGo to next message
John Watson
Messages: 3103
Registered: January 2010
Location: Global Village
Senior Member
Do you need to use pl/sql? I would have thought that an INSERT with an error logging clause would be the easiest way,
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9014.htm#BGBEIACB
Re: copying data from table(with no constraints) to table with constraints [message #557514 is a reply to message #557495] Wed, 13 June 2012 07:34 Go to previous messageGo to next message
shreeka
Messages: 5
Registered: June 2012
Junior Member
the constraints will be defined on the destination table..... thats how oracle wud know the constraint violations
Re: copying data from table(with no constraints) to table with constraints [message #557517 is a reply to message #557514] Wed, 13 June 2012 07:38 Go to previous messageGo to next message
cookiemonster
Messages: 9141
Registered: September 2008
Location: Rainy Manchester
Senior Member
So what's wrong with John's suggestion?
Re: copying data from table(with no constraints) to table with constraints [message #557520 is a reply to message #557514] Wed, 13 June 2012 07:41 Go to previous messageGo to next message
shreeka
Messages: 5
Registered: June 2012
Junior Member
Yes John.... I have to use PL/SQL. Can i use Insert with Error Log through PL/SQL?
Re: copying data from table(with no constraints) to table with constraints [message #557523 is a reply to message #557520] Wed, 13 June 2012 07:50 Go to previous message
Michel Cadot
Messages: 54155
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
PL/SQL User's Guide and Reference
Application Developer's Guide - Fundamentals

Regards
Michel
Previous Topic: VARCHAR2 to date
Next Topic: Mutating trigger error
Goto Forum:
  


Current Time: Mon May 20 22:20:42 CDT 2013

Total time taken to generate the page: 0.13006 seconds