| sm_ahmeds |
Posted: Sep 26, 2007 04:24:08 AM |
Total Post: 53
Joined: Apr, 2007
|
There is a table by the name SAMPLE in the ORACLE database.
There is a field namely LOGIN_DATE in the table
The format of this field is 01-JAN-07
I had to delete the rows from the table based on this field.
I had to delete all rows before 01-JAN-07
Please give me the query.
And also please tell give the query if table is linked to another table through foreign key or primary key |
|
|
Ramesh Joyisa |
| Posted: Sep 26, 2007 06:28:43 AM | |
|
Total Post: 226
Joined: Aug, 2007
|
I hope that the LOGIN_DATE is a date field.
DELETE FROM SAMPLE WHERE LOGIN_DATE < to_date('01-JAN-07');
|
|
|
|
|
sm_ahmeds |
| Posted: Sep 26, 2007 06:48:34 AM | |
|
Total Post: 53
Joined: Apr, 2007
|
YES
HOWEVER THE TABLE HAS CHILD RECORDS
CAN U PLS TELL HOW TO DELETE CHILD RECORDS ASLO
THANKS
|
|
|
|
|
krish |
| Posted: Oct 04, 2007 02:05:19 PM | |
|
Total Post: 4
Joined: May, 2007
|
drop and recreate the foreign key constraint on child table using on delete cascade option
example:
alter table <tablename> add constraint <Constraint Name> foreign key(colanme) references Master_TABLE_NAME(primarykey col name) on delete cascade;
then delete the records in master.
|
|
|
|
|
positive |
| Posted: Jun 29, 2008 02:55:39 PM | |
|
Total Post: 416
Joined: Jun, 2008
|
To overcome problem of integrity constraints we can make use of ON DELETE CASCADE;
If not delete rows in parent table before deleting corresponding child records in dependent table.
Visit:
http://neworacledba.blogspot.com/
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |