How to delete last n records from table in Oracle

25 pts.
Tags:
Oracle
Oracle Table
How can I delete the last n records from a table in Oracle?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen
    Assuming this is a part of Oracle certification. However you can try by using order by with rownum. You can link here for more information, http://docs.oracle.com/database/121/SQLRF/statements_8005.htm#SQLRF01505

    But, be careful, if it is an office environment, then take backup of your oracle data first.

    77,270 pointsBadges:
    report
  • dvr4589
    I tried by using sort by rownum. But I am getting error. Please suggest the exact query how to delete last n records.
    25 pointsBadges:
    report
  • carlosdl
    What exactly do you mean by "last" in this case?

    Rows in a table don't have a predefined or default order.  You can only talk about "last" or "first" when you have some sorting criteria that are based on some column from the table.
    83,990 pointsBadges:
    report
  • dvr4589
    I got the answer. Thanks for your suggestions.
    25 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: