DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Database processing using DML statement

  1. #1
    Join Date
    Sep 2006
    Location
    London
    Posts
    58

    Database processing using DML statement

    I wish to remove all the concern records from J63 tables matchs similarly with K63 tables on the basis of comumn column c1 and ticketid.

    DELETE FROM J63 a WHERE ticketid IN ( SELECT c1 FROM K63 b
    WHERE a.ticketid=b.c1 and integerdate ( c3 ) < add_months( sysdate, -36 ))

    integerdate is a function name.

    Can you suggest me whether it is correct or not?

    Is there any better way to remove records quickly like join options?

  2. #2
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    only you know if it deletes the data you want

  3. #3
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    DELETE FROM J63 a WHERE ticketid IN ( SELECT c1 FROM K63 b
    WHERE a.ticketid=b.c1 and integerdate ( c3 ) < add_months( sysdate, -36 ))
    IN subquery does not need join with the outer query.

    You can change the code:
    Code:
    DELETE FROM J63 a 
    WHERE exists 
            ( SELECT 'x' FROM K63 b
             WHERE a.ticketid=b.c1 and 
                       integerdate ( c3 ) < add_months( sysdate, -36 )
            )
    Tamil
    www.oracleact.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width