Question:
Now from these tables I need to delete record based on a criteria as date (something like -delete all records from these tables created before 30th march). Now these column has constraints and has to be deleted in the order A,B.....H. These are the common column in all the tables......Parent ID and Created_date Can I get some advice on how it can be acheived? I can delete it individually by running a delete statment, as you all know that is fairly simple. But I have around 6000 rows so its difficult. If you have control over your constraints, maybe try setting them up as DELETE CASCADE : SQL> create table parent (pk number primary key); Table created. SQL> create table child (pk number primary key,
Table created. SQL> create table child_of_child (pk number primary key,
Table created. SQL> insert into parent values (1);
SQL> insert into parent values (2);
SQL> insert into parent values (3);
9 rows inserted SQL> select * from parent; PK
SQL> select * from child; PK
FK
SQL> select * from child_of_child; PK
FK
Then, when you delete from the parent, the children go with : SQL> delete from parent where pk in (1,2); 2 rows deleted. SQL> select * from parent; PK
SQL> select * from child; PK
FK
SQL> select * from child_of_child; PK
FK
Have a Oracle Question
Oracle Books
Oracle Application
Oracle Home
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|