Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8947335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:43:58+00:00 2026-06-15T12:43:58+00:00

I am facing issue deleting set of records from a table named links_data because

  • 0

I am facing issue deleting set of records from a table named links_data because of huge set of data to be deleted and the Oracle DB ran out of temp space.

For the same with little knowledge of mine on Stored Procedure I wrote the below code.
But the Stored Procedure looks to be running slow as well.

The scenario is that I need to delete the rows from links_data table where the nm_folder column in links_data table has foreign key relation with link_folders table. nm_folder in link_folders table is the primary key and I intend to delete 10000 records at a time and commit and then again delete 10000 records and commit.

Kindly anyone please help me optimize this query. Thanks & Regards,

Declare

Type ty_link_floder is table of number;

tble_id_folder ty_link_floder;

    Cursor c_data is
    select id_folder from link_folders where nm_folder='User Hotlist';

    Begin
    OPEN c_data;

      LOOP
        FETCH c_data
        BULK COLLECT INTO tble_id_folder LIMIT 10000;
        EXIT WHEN tble_id_folder.count = 0;
                    FORALL i IN tble_id_folder.first .. tble_id_folder.last
        DELETE FROM links_data
        WHERE id_folder = tble_id_folder(i);
        COMMIT;

        -- Process contents of collection here.

        DBMS_OUTPUT.put_line(tble_id_folder.count || ' rows deleted from links_data table so far');
        tble_id_folder.delete;
      END LOOP;
      CLOSE c_data;
    Exception
     When others Then
      Commit;
      Raise;
    End;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:43:59+00:00Added an answer on June 15, 2026 at 12:43 pm

    I’d try it first in one SQL statement:

    DELETE FROM links_data d
     WHERE id_folder IN (
           SELECT id_folder FROM links_folder WHERE nm_folder='User Hotlist');
    

    If you run out of temp space and the DBAs cannot set up additional temp space, the best way is to recreate the table without the rows that should be deleted:

    CREATE TABLE links_data_tmp AS
    SELECT * FROM links_data d
     WHERE id_folder NOT IN (
           SELECT id_folder FROM links_folder WHERE nm_folder='User Hotlist');
    

    After that, you need to rebuild all indexes and constraints on links_data_tmp that have been defined on links_data. Then you can swap the temporary table with the real one:

    RENAME links_data TO links_data_old;
    RENAME links_data_tmp TO links_data;
    

    Don’t forget to reapply all the privileges, too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing strange issue. I have wep-part that reads data from user's profile.
I have been facing issue with sphinx result set for string attribute. Below is
I got below JSON string, i facing issue parsing because it contains non english
Facing some issue in Talend Admin Console, the jobs that are running from IDE
I am facing an issue in jqgrid's treegrid. For local data the tool barserch
I m facing issue to access the bridge table to get the values using
I am facing an issue where my Rails application is set to cache classes
I am facing one issue because of URL encoding in window.open function when used
I'm facing some permission issue while deleting android bookmarks: java.lang.SecurityException: Permission Denial: writing com.android.browser.provider.BrowserProvider2
I am facing issue while loaidng the data in JQGrid at a later stage

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.