How to delete rows from multiple tables [message #38404] |
Tue, 16 April 2002 20:55 |
T.Manikandan
Messages: 6 Registered: April 2002
|
Junior Member |
|
|
Hi,
I am new to oracle and may be this question is easy..
I have 2 tables in which name is the primary key and in both tables, names are equal. I want to delete the
rows in both tables with certain criteria.
Ex :
Table A
Name Value
abc 5
edf 6
Table B
Name salary number
abc 10000 66
edf 11111 77
I want to delete the rows from both the tables
where Name = abc and A.value <= 5.
Any help is appreciated..
Thanks..
|
|
|
Re: How to delete rows from multiple tables [message #38407 is a reply to message #38404] |
Wed, 17 April 2002 00:07 |
Epe
Messages: 99 Registered: March 2002
|
Member |
|
|
Hello,
first of all, check if there are constraints linking the two tables. It's possible that if you delete the record in table A, all records with the same name in table B will be deleted...
If not, then you can do it simply by using two delete statements :
delete from table A
where name = 'abc'
and value <= 5;
Use the same statement with table B afterwards.
If you want to "save" this change : commit.
Success,
epe
|
|
|
Re: How to delete rows from multiple tables [message #38410 is a reply to message #38404] |
Wed, 17 April 2002 01:29 |
T.Manikandan
Messages: 6 Registered: April 2002
|
Junior Member |
|
|
Hi epe,
Thanks a lot for your kind reply.
I want to delete the rows in both tables in a single
query.In both table the tables Name value is unique.
Hence i want to delete the rows in both tables
in a single query with by checking one constraint in
the table A.
Thanks.
|
|
|
|