exact number of lines deleted when on_delete_cascade is active in the referential integrity

Hi all

I have here the question (restructured for simplicity):

Suppose that I have a table used, which has a primary key emp_id and a mgr_id foreign key referencing emp_id:

create table abc () number Middle eid number

constraint of pk primary key(eid),

constraint of fk stranger key (mid) referencing abc(eid) on delete cascade

)

Select * de abc

EIDMID
4
1
21
31
51
62

If I issue a delete as below:

delete from abc where eid = 1

After running above sql, the number of rows sql % gives me the deleted rows = 1, but in fact, had to remove cascade, 5 rows are deleted.

My question is how can I the exact number of rows deleted from the table in this scenario?

What SQL ROWCOUNT percentage watch you is correct because it shows the number of lines made directly by the statement you issue.  All knock on effects by cascading deletes, or triggers are not included.

The only real way you'd be able to get a number of lines (assuming nothing else bothers while you do) this is to count the lines service based on your business logic for related lines and then remove them, or maybe put a trigger delete (be aware of the drop in performance) on deletions for lines that puts something like the primary key for a global temporary table (available lines only for your session) that you can then query after how many rows have been completed.

Tags: Database

Similar Questions

  • I noticed that my remote access has been activated twice in a week but I did not. no way to verify when, what, who activated via the event log,...?

    I noticed that my remote access has been activated twice in a week but I did not. no way to verify when, what, who activated via the event log,...?

    Hi dewthisnow,

    The information office for remote access must be in the security log.

    For more information, see:

    To disable remote desktop

    To view the logs in Event Viewer, see:

    Using the event viewer        

    Procedure to view and manage event logs in Event Viewer in Windows XP

  • Maximum number of lines per Page to include

    <! - this Configuration setting is managed by Oracle Business Intelligence Enterprise Manager - >

    < DefaultRowsDisplayedInDelivery > 75 < / DefaultRowsDisplayedInDelivery >


    I'm unable to change the maximum number of lines per Page to be included in the EM. This will automatically return to 75 after acivating changes.

    Can someone please help on this.


    Thank you

    Abhilash.K

    8506060755

    Hi Virginia,

    After the edition of the MA,.

    • Apply
    • Activate changes
    • Restart presentation Services

    Presentation Services restart will make the change.

    Thank you

    JP

  • View object number of lines

    I have an inputNumberSlider and I want the value to the number of lines of my VO. What is the best practice?


    JDev 11.1.1.6

    I created an executable iterator and then use the EL #{bindings. QuestionsView1Iterator.estimatedRowCount}

    What is ADF correctly to do?

  • Is it possible to change the number of lines to display in the query of the adf?

    Hello

    is it possible to change the number of lines that appear in a query of the adf that is similar to a form of the adf?

    I need about 5 lines per column rather than display all the fields in a single column to display? Thank you.

    Hello

    What do you mean that it didn't work? Attributes of how you have in the Panel of the query? Maybe you have fewer number than the combination or lines and the properties of the argument maxColumns attributes.

    Try again with

    and see if you are able to get everything under a single column. If you get, play with these two properties to get the desired result.

    Arun-

  • How can I make a number of lines?

    I have a very large table, 200 GB +.

    the table is just below:

    I want to know how many lines belongs to A, the number of lines belongs to B, etc and so on.

    its better to order the result of the largest line count everything first. Thank you very much.

    Column1 Column2
    A 125
    A 225
    A 585
    A 8585
    B 458
    C 458
    C 154
    D 5487

    Hello

    Karl says:
    ... its better to order the result by the greatest number of lines first...

    For the highest first, you specify descending order:

    SELECT    column1
    ,        COUNT (*)     AS cnt
    FROM        mytable
    GROUP BY  column1
    ORDER BY  cnt          DESC
    ;
    

    Just 'ORDER BY cnt' (or "ORDER BY 2") would finally put the highest number.

  • display the Total number of lines in the first page of the report

    Hi, in obiee, paging will be 1-25. Is there any possibility in obiee to display the total number of lines next to paging. Ex: If the result contains the 120 lines. It should show after paging

    Documents 1-25. Total records: 120

    User,

    If this is the very simple case go in narrative display

    In the Narrative section give

    No.Of.Records: @4

    in my case is 4th column: No.Of.Records where fx = max (rcount (1))

    GoTo Compound display click the button Add and align narrative view down to see table

    Thank you
    Saichand.v

  • ORA-01422: exact fetch returns more than number of lines

    Hello world

    I want to create a procedure only allows me to perform selection et Update in my database, I have already create the procedure and compiled without problems but when I want to run this procedure, I have this error

    ORA-01422: exact fetch returns more than number of lines

    This syntax of my procedure

    create or replace procedure app is

    i nombre := 100 ;

    o_username employees.first_name% TYPE ;

    o_lastn employees. Last_name %TYPE

    o_sal. employees % of SALARY TYPE ;

    Start

    loop

    / * display * /.

    Select first_name, LAST_NAME, SALARY

    in o_username, o_lastn, o_sal

    of admin.employees where employee_id = i;

    DBMS_OUTPUT. Put_line (' name: ' | o_username);

    DBMS_OUTPUT. Put_line (' first name: ' | o_lastn);

    DBMS_OUTPUT. Put_line (' salary: ' | o_sal)

    / * put a days * /.

    Update employees

    put salary = salary + salary *0.25 where employee_id = i;

    commit;

    / * dbms_put.put_line (' new salary is: ' | ') sell2_tab (i)); * /

    i := i + 1 ;

    / * list the data * /

    / * dbms_put.put_line (' new salary is: ' ") ;*/

    output when i = 200;

    end loop;

    end app;

    thnx

    create or replace procedure APP is

    Constant START_ID EMPLOYEES. EMPLOYEE_ID % TYPE: = 100;

    Constant END_ID EMPLOYEES. EMPLOYEE_ID % TYPE: = 200;

    O_USERNAME EMPLOYEES. Type % name;

    O_LASTN EMPLOYEES. Last_name type %;

    O_SAL EMPLOYEES. Kind of % of SALARY;

    Start

    for rec (select FIRST_NAME, LAST_NAME, salary

    the admin. EMPLOYEES

    where EMPLOYEE_ID between START_ID and END_ID)

    loop

    DBMS_OUTPUT. Put_line (' name: ' | rec. NAME);

    DBMS_OUTPUT. Put_line ("first name:" | ") Rec. LAST_NAME);

    DBMS_OUTPUT. Put_line (' salary: ' | rec. SALARY) / * setting days * /.

    end loop;

    Update EMPLOYEES

    Set SALARY = SALARY + SALARY * 0.25

    where EMPLOYEE_ID between START_ID and END_ID;

    commit;

    end app;

  • exact fetch returns more than number of lines

    Hello

    I have here is the procedure to kill session from blocking. It works fine if a row is returned to select it.
    How can I change to operate multiple lines?

    CREATE OR REPLACE PROCEDURE kill_blocking IS
    l_sid NUMBER (10);
    l_serial NUMBER (10);
    l_wait NUMBER (10);
    l_username VARCHAR2 (20);
    sqlstmt VARCHAR2 (1000);
    BEGIN
    SELECT s1. SID, s1.serial #, s2.seconds_in_wait, s2.username
    IN l_sid, l_serial, l_wait, l_username
    V $ lock l1.
    v$ session s1,.
    v$ lock l2,.
    v$ session s2,.
    v$ sql sqlt1.
    v$ sql sqlt2
    WHERE s1. SID = l1. SID
    AND s2. SID = l2. SID
    AND sqlt1.sql_id = s2.sql_id
    AND sqlt2.sql_id = s1.prev_sql_id
    AND l1. BLOCK = 1
    AND l2.request > 0
    AND l1.id1 = l2.id1
    AND l2.id2 = l2.id2;
    IF l_username = "APP" AND l_wait > 100
    THEN
    sqlstmt: =.
    "ALTER SYSTEM KILL SESSION"'.
    || To_char (l_sid)
    || ','
    || To_char (l_serial)
    || '''';
    Dbms_output.put_line (sqlstmt);
    EXECUTE IMMEDIATE sqlstmt;
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    Dbms_output.put_line ('no data found');
    END;
    /


    SQL > exec kill_blocking;
    BEGIN kill_blocking; END;

    *
    ERROR on line 1:
    ORA-01422: exact fetch returns more than number of lines
    ORA-06512: at TK. "KILL_BLOCKING", line 8
    ORA-06512: at line 1

    Hello

    You can use the procedure below

    create or replace

    PROCEDURE kill_blocking_mig

    IS

    l_sid NUMBER (10);

    l_serial NUMBER (10);

    l_wait NUMBER (10);

    l_username VARCHAR2 (20);

    sqlstmt VARCHAR2 (1000);

    CURSOR status_cus IS

    SELECT s1. SID, S1. Serial #, s2.seconds_in_wait, s2.username

    V $ lock l1.

    v$ session s1,.

    v$ lock l2,.

    v$ session s2,.

    v$ sql sqlt1.

    v$ sql sqlt2

    WHERE s1. SID = l1. SID

    AND s2. SID = l2. SID

    AND sqlt1.sql_id = s2.sql_id

    AND sqlt2.sql_id = s1.prev_sql_id

    AND l1. BLOCK = 1

    AND l2.request > 0

    AND l1.id1 = l2.id1

    AND l2.id2 = l2.id2;

    BEGIN

    OPEN status_cus.

    loop

    extract the status_cus IN l_sid, l_serial, l_wait, l_username;

    When the output status_cus % notfound;

    IF l_username = "APP" AND l_wait > 100 THEN

    sqlstmt: = ' EDIT the SYSTEM KILL SESSION "' | To_char (l_sid) | ',' || To_char (l_serial) | '''';

    Dbms_output.put_line (sqlstmt);

    EXECUTE IMMEDIATE sqlstmt;

    END IF;

    end loop;

    EXCEPTION

    WHEN NO_DATA_FOUND THEN

    Dbms_output.put_line ('no data found');

    END;

  • Error ORA-01422 apex: exact fetch returns more than the required number of line

    Hi people,

    Apex 4.1
    I have a page that works like a charm.

    Based on my application I need I have to perform the same operation for the different regions. As a quick and better method, I copied the page and branched, it inspires tab for this region.

    The problem is that the original page works fine.
    I haven't changed anything except the parent set to this copied page tab and works that I find with the above error.

    It allows me to make the first entry on this page, but when I try to access the page again it gives me this error.

    The error in detail is as below:

    is_internal_error: false
    ora_sqlcode:-1422
    ora_sqlerrm: ORA-01422: exact fetch returns more than number of lines
    Component.type: APEX_APPLICATION_PAGE_PROCESS
    Component.ID: 214936714355373108
    Component.Name: EMP_LEAVE_INFO line
    error_backtrace:
    ORA-06512: at line 1
    ORA-06512: at "SYS." DBMS_SYS_SQL", line 1926
    ORA-06512: at "SYS." WWV_DBMS_SQL', line 973
    ORA-06512: at "SYS." WWV_DBMS_SQL', line 999
    ORA-06512: at "APEX_040200.WWV_FLOW_DYNAMIC_EXEC", line 806
    ORA-06512: at "APEX_040200.WWV_FLOW_DML", line 336
    ORA-06512: at "APEX_040200.WWV_FLOW_PROCESS", line 332

    >
    As a quick and better method, I copied the page and branched, it inspires tab for this region.
    >

    Copy paste is never advisable. It can be fast in some cases, there is an anti-pattern.

    Be aware that the automatic extraction of the APEX line is based on a component of demand.

    It is possible that your automatic rowfetch is based on the element of your previous page. If you for example to change the name of the table, but do not change the reference is the primary key value, then you can pass a value to your table that was not unique. This would result in ORA-01422.

    Find the value of the session element and run your query.

    Concerning

    Nico

  • Error - ORA-01422: exact fetch returns more than number of lines

    Hello

    I get the error when running script below. Please help me.

    /****************** ERROR ******************/

    Error report:
    ORA-01422: exact fetch returns more than number of lines
    ORA-06512: at line 71
    01422 00000 - "exact fetch returns more than number of lines."
    * Cause: Exact extraction specified number is less than the returned rows.
    * Action: Rewrite the query or change the number of rows requested



    /****************** SCRIPT ******************/

    DECLARE

    l_xml XMLTYPE: = XMLTYPE ("< LoggingInformation >
    < commandeEmplacement >
    < name > ServiceCall1 < / name >
    < StartTime > 2010-01-18T 11: 11:41.570664 - 00:00 < / StartTime >
    < EndTime > 2010-01-18T 11: 11:43.8987741 - 00:00 < / EndTime >
    < ElapsedTime > 00:00:02.3281101 < / ElapsedTime >
    < status > completed < / status >
    < ExceptionMessage > error here... < / ExceptionMessage >
    < ExceptionStackTrace > Stack Trace here... < / ExceptionStackTrace >
    < ServiceLoggingEntries >
    < item >
    < foo > 1 < / foo >
    < / ServiceInformation >
    < item >
    < foo > 2 < / foo >
    < / ServiceInformation >
    < / ServiceLoggingEntries >
    < InformationLoggingEntries >
    < ProcessInformation >
    < bar > 1 < / >
    < / ProcessInformation >
    < ProcessInformation >
    < bar > 2 < / >
    < / ProcessInformation >
    < / InformationLoggingEntries >

    < / commandeEmplacement >
    < commandeEmplacement >
    < name > ServiceCall2 < / name >
    < StartTime > 2010-01-18T 11: 11:41.570664 - 00:00 < / StartTime >
    < EndTime > 2010-01-18T 11: 11:43.8987741 - 00:00 < / EndTime >
    < ElapsedTime > 00:00:02.3281101 < / ElapsedTime >
    < status > completed < / status >
    < ExceptionMessage > error here... < / ExceptionMessage >
    < ExceptionStackTrace > Stack Trace here... < / ExceptionStackTrace >
    < ServiceLoggingEntries >
    < item >
    < foo > 3 < / foo >
    < / ServiceInformation >
    < item >
    < foo > 4 < / foo >
    < / ServiceInformation >
    < / ServiceLoggingEntries >
    < InformationLoggingEntries >
    < ProcessInformation >
    < bar > 3 < / >
    < / ProcessInformation >
    < ProcessInformation >
    < bar > < / > 4
    < / ProcessInformation >
    < / InformationLoggingEntries >
    < / commandeEmplacement >

    < commandeEmplacement >
    < name > ServiceCall3 < / name >
    < StartTime > 2010-01-18T 11: 11:41.570664 - 00:00 < / StartTime >
    < EndTime > 2010-01-18T 11: 11:43.8987741 - 00:00 < / EndTime >
    < ElapsedTime > 00:00:02.3281101 < / ElapsedTime >
    status of <>failed < / status >
    < ExceptionMessage > error here... < / ExceptionMessage >
    < ExceptionStackTrace > Stack Trace here... < / ExceptionStackTrace >
    < / commandeEmplacement >
    (< / LoggingInformation > ');

    v_txt VARCHAR2 (2000);

    BEGIN

    SELECT XMLTYPE. Extract (value (TT),'/ CommandInformation/Name/Text () '). GETSTRINGVAL()
    IN v_txt
    TABLE (XMLSEQUENCE (l_xml. Extract('/LoggingInformation/CommandInformation'))) tt;

    DBMS_OUTPUT. Put_line (v_txt);

    END;

    Select...

    means only 1 row can be returned.

    Your select returns more than one line.
    Change v_txt in a collection, define a cursor and the extraction of it or change the statement, i.e. it returns a single line.

    ---------
    Sybrand Bakker
    Senior Oracle DBA

  • "Getting the error 'exact fetch returns more than number of lines.

    Hi try to run a query of Iam
    but when I run what it it gives an error
    Error report:
    ORA-01422: exact fetch returns more than number of lines
    ORA-06512: at line 9 level
    01422 00000 - "exact fetch returns more than number of lines."
    * Cause: Exact extraction specified number is less than the returned rows.
    * Action: Rewrite the query or change the number of rows requested
    here's my querey

    SET SERVEROUTPUT ON
    DECLARE
    Emp_table_type TYPE IS an ARRAY OF
    hr_api_transactions % ROWTYPE INDEX BY PLS_INTEGER;
    my_emp_table emp_table_type;

    BEGIN
    I'm in 1.53
    LOOP
    SELECT * INTO my_emp_table (i) FROM hr_api_transactions
    WHERE transaction_ref_table = 'PER_ALL_VACANCIES ';
    END LOOP;
    BECAUSE me IN my_emp_table. FIRST... my_emp_table. LAST
    LOOP
    DBMS_OUTPUT. Put_line (my_emp_table (i) .transaction_document);
    END LOOP;
    END;

    Hello

    'Re missing you the bulk of the Collections. Ask that you well want to have a glance on manual of oracle collections.
    Replace your code...

    DECLARE
    TYPE emp_table_type IS TABLE OF
    hr_api_transactions%ROWTYPE INDEX BY PLS_INTEGER;
    my_emp_table emp_table_type;
    BEGIN
    SELECT *
    BULK COLLCT INTO my_emp_table
    FROM hr_api_transactions
    WHERE transaction_ref_table = 'PER_ALL_VACANCIES';
    FOR i IN my_emp_table.FIRST..my_emp_table.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE(my_emp_table(i).transaction_document);
    END LOOP;
    END;
    

    Before you run the above script, don't forget to run the

    set serveroutput on
    

    I hope this helps.

    PS-> mark as Complete/useful, if the apporoach above meets the expected result

    Kind regards
    Claudy

  • ERRO ORA-01422: exact fetch returns more than number of lines

    SET SERVEROUTPUT ON
    create or replace procedure copy
    AS

    cursor c2 IS
    Select t.country_code
    transactions t;

    v_lc_details_current_hist c2% rowtype;
    v_country_code transactions.country_code% TYPE;

    Start


    Open c2;
    loop

    extract the c2 in v_lc_details_current_hist;


    OUTPUT WHEN c2% NOTFOUND;



    Select the country_code in v_country_code of transactions;

    DBMS_OUTPUT. Put_line (v_country_code);

    end loop;

    Close c2;

    end;
    /



    I'm gettintha error ORA-01422: exact fetch returns more than number of lines

    Please help me

    [email protected] wrote:
    Select the country_code in v_country_code of transactions;
    -It's to return several rows, and the SELECT INTO statement expects that one line.

    A SELECT INTO statement can be used if you want a query to return only one row. Otherwise use bulk collect and a variable of class to contain the result lines multiples.

  • Delete in af:table always remove the first line when using ExecuteWithParams

    Hello world

    I got a page with master form and af:table two details related to the master. When I'm trying to remove a line in an af:table of detail, it always removes the first line, any line, I selected before. The table has a single = rowSelection and the line is properly visually selected. I remove the line using a "delete hyperlink" on each line, but I first have to select the line. Delete called a bond (or a method at the bean by removing the current line of the iterator, I tried both, none of them work)

    Links page has an ExecuteWithParams defining the correct ID to edit on the master of iterator and an InvokeExecuteWithParams the renderModel value. If I put the refresh condition zero and I hard-code an ID in the binding variable in the model, I am able to delete the selected line.

    In addition, I don't know if this information is useful, but if I set the iterator to PPR ChangeEventPolicy, when I select a line, there always select the first line.

    Any ideas what I could do wrong? Is this a bug?

    I use JDev 11.1.1.7

    Thank you

    Guillaume

    You can try creating a method in ApplicationModule for filter master records instead of executeWithParams?

    Ashish

  • Installation of Adobe met an unexpected failure when you attempt to install the first instance of AdobeAcrobatPro DC.  It is the exact error message and seems to be the case for a number of users.  I am running Windows 7 and has already managed to success

    Installation of Adobe met an unexpected failure when you attempt to install the first instance of AdobeAcrobatPro DC.  It is the exact error message and seems to be the case for a number of users.  I am running Windows 7 and was already able to install Adobe Acrobat Reader DC and have Adobe Flash Player 10 ActiveX installed successfully.  It's the exact error message, there is NO error code!   It seems as there is no support number to contact Adobe to, and the only way to receive the 'support' is through the forum.   PLEASE ANSWER!

    Untitled.jpg

    Hi tracyes31040766,

    If it you please run this tool cleaner Download Adobe Reader and Acrobat cleaning - Adobe Labs tool to remove the old Acrobat, retsrat your system plates & then try to install it again using this link Download Adobe Acrobat free trial | Acrobat Pro DC.

    Let me know how it goes.

    Kind regards

    Nicos

Maybe you are looking for

  • RT FIFO only element Variable is always buffering...

    First off the coast, I'm new to LabView and cRIO... Core 1, Core 2 and RT 1 filled online. No other experience. I have a cRIO 9074 with some local IO also speak several Modbus TCP slave. I was able to glean from my training for RT systems (NI unique

  • Signal affecting laptop computer charger

    I use an NI USB-6216 data acquisition and my held my load cell signal cuts out when I plugged into a laptop. When I unplugged the power cord, everything works fine. See the results below: The top graph: unplug the power cord. Average chart: full, con

  • Select in to out, then climb a track.

    I would like to start my 'outside' and then only move the selection up a track.In FCP I can choose my my released then highlight the selection and climb a video track. It is a fast production flow chooses long tongs.I want a solution with the least a

  • IOM connection error

    HelloI try to use OIM 11 g API creating user, update user and toggle. I use custom loggers to print the loggers.There is a generated error when I try to accomplish the above every time mentioned operations. He is able to connect to IOM and successful

  • Why can't I go into Adobe Creative cloud?

    I installed Adobe Creative cloud to create drawings in adobe illustrator. I use a brand new Windows 7 computer. I clicked on the icon, it says that creative cloud needs an update, the 'fine ok.' Its starts updating, but it stops at 2% and he says "Tr