Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Query to find out rows deleted from a table

ORA_AJDec 8 2009 — edited Oct 19 2010
Hi

Suppose i have a table with a sequence i.e its an header table containing GRN nos.Now suppose someone has deleted some of serials from it like i am having 1,2,4,5,6 etc 3 is missing.Now what will be the query to find out what are the serials that are missed out in the table.


--Ajay Sharma

Comments

155651
You can make use of user defined objects in Oracle 8 onwards. You can create either table of objects or varray of objects.

Mohan
395113
I am giving you an example of using array of Record


DECLARE
-- declaration of Record
TYPE REC1 IS RECORD (COLUMN1 VARCHAR2(10),
COLUMN2 DATE) ;
-- Array of Record
TYPE TAB1 IS TABLE OF REC1 INDEX BY BINARY_INTEGER ;
TAB2 TAB1 ;
-- New Procedure
PROCEDURE P1 (TAB3 TAB1) IS
BEGIN
FOR I IN 1..10 LOOP
DBMS_OUTPUT.PUT_LINE(TAB3(I).COLUMN1||'-'||TAB3(I).COLUMN2) ;
END LOOP ;
END ;

BEGIN
FOR I IN 1..10 LOOP
TAB2(I).COLUMN1 := I ;
TAB2(I).COLUMN2 := TO_DATE('23/05/2003','DD/MM/YYYY') ;
END LOOP ;

P1(TAB2) ;

EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM) ;
END ;

I am assigning some values to array and passing it to an procedure and printing the value . The printing procedure
can exists separately also . Hope this solves your issue .
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 16 2010
Added on Dec 8 2009
9 comments
18,872 views