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

  • Home
  • SEARCH
  • 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 9174365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:44:37+00:00 2026-06-17T16:44:37+00:00

I’m executing a statement like DELETE FROM USER WHERE USER_ID=1; In SQLDeveloper. As the

  • 0

I’m executing a statement like

DELETE FROM USER WHERE USER_ID=1;

In SQLDeveloper.

As the user is referenced in many tables (for example the user has an order, settings, …) we activated ON DELETE CASCADE so that we do not have to delete each and every row manually. However while developing we are interested to know how many rows and and in which tables are “automatically” deleted by cascade delete.

Is there any way to find this out. Either by SQL-Statement, directly in sqldeveloper from a logfile or any other idea?

  • 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-17T16:44:39+00:00Added an answer on June 17, 2026 at 4:44 pm

    whilst this is not possible with sql%rowcount, it is possible if you write trigger code, but this means that you need a trigger on all tables you want to monitor. Also triggers would slow down operations a bit.

    e.g.:

    SQL> select * from one;
    
            ID
    ----------
             1
             2
    
    SQL> select * from child_of_one;
    
            ID       O_ID
    ---------- ----------
             1          1
             2          1
             3          1
             4          2
             5          2
             6          2
             7          2
             8          2
    

    we want a package spec to hold an array of tables + counts:

    SQL> create or replace package foo
      2  as
      3    type rowcount_tab is table of pls_integer index by varchar2(30);
      4    t_rowcount rowcount_tab;
      5  end foo;
      6  /
    
    Package created.
    

    we want a trigger on the top level table to reset these counts to zero:

    SQL> create or replace trigger one_biud
      2  before insert or update or delete
      3  on one
      4  declare
      5  begin
      6    foo.t_rowcount.delete;
      7  end;
      8  /
    
    Trigger created.
    

    this assumes that you’re only interested in the array with a delete from the top level table. if not, you’d want a trigger on each table with foo.t_rowcount.delete('TABLE_NAME') instead.

    now a after for each row trigger on each table of interest to set the arrays:

    SQL> create or replace trigger one_aiudfer
      2  after insert or update or delete
      3  on one
      4  for each row
      5  declare
      6  begin
      7    if (foo.t_rowcount.exists('ONE'))
      8    then
      9      foo.t_rowcount('ONE') := nvl(foo.t_rowcount('ONE'), 0)+1;
     10    else
     11      foo.t_rowcount('ONE') := 1;
     12    end if;
     13  end;
     14  /
    
    Trigger created.
    
    SQL> create or replace trigger child_of_one_aiudfer
      2  after insert or update or delete
      3  on child_of_one
      4  for each row
      5  declare
      6  begin
      7    if (foo.t_rowcount.exists('CHILD_OF_ONE'))
      8    then
      9      foo.t_rowcount('CHILD_OF_ONE') := nvl(foo.t_rowcount('CHILD_OF_ONE'), 0)+1;
     10    else
     11      foo.t_rowcount('CHILD_OF_ONE') := 1;
     12    end if;
     13  end;
     14  /
    
    Trigger created.
    

    now when we delete or whatever:

    SQL> delete from one where id = 1;
    
    1 row deleted.
    
    SQL> declare
      2    v_table varchar2(30);
      3  begin
      4    v_table := foo.t_rowcount.first;
      5    loop
      6       exit when v_table is null;
      7             dbms_output.put_line(v_table || ' ' || foo.t_rowcount(v_table) || ' rows');
      8             v_table := foo.t_rowcount.next(v_table);
      9     end loop;
     10  end;
     11  /
    CHILD_OF_ONE 3 rows
    ONE 1 rows
    
    PL/SQL procedure successfully completed.
    
    SQL> delete from one where id = 2;
    
    1 row deleted.
    
    SQL> declare
      2    v_table varchar2(30);
      3  begin
      4    v_table := foo.t_rowcount.first;
      5    loop
      6       exit when v_table is null;
      7             dbms_output.put_line(v_table || ' ' || foo.t_rowcount(v_table) || ' rows');
      8             v_table := foo.t_rowcount.next(v_table);
      9     end loop;
     10  end;
     11  /
    CHILD_OF_ONE 5 rows
    ONE 1 rows
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has

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.