If there are 1 to 100 numbers in a table and in that 100
numbers some 10 numbers are deleted.I want to find out the
missing numbers between 1 to 100 by pl/sql how?

Answer Posted / neha sinha

create or replace procedure pro1(cur_diff OUT SYS_REFCURSOR) is
BEGIN
OPEN cur_diff FOR

select diff
from (select /*+ no_merge */
rownum as diff
from (select 1 from dual group by cube(1, 1,
1, 1, 1)) a,
(select 1 from dual group by cube(1, 1,
1, 1, 1, 1)) b)
where diff >= (select min(lst) from list1)
and diff <= (select max(lst) from list1)
minus
select lst from list1;
end pro1;
-- where list1 is table name and lst is column in which
--some no is missing

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a stored procedure in sql with example?

598


What is sql used for?

641


What is a database trigger?

607


What are local and global variables and their differences?

580


What are stuff and replace function?

568






How to look at the current sql*plus system settings?

604


Is it possible to create startup or shutdown trigger for on-schema?

579


what is schema? : Sql dba

560


what is the difference between char and varchar data types? : Sql dba

529


What are analytical functions in sql?

534


How to revise and re-run the last sql command?

644


what is sql? : Sql dba

557


Why join is faster than subquery?

597


What is bind reference and how can it be created?

576


What is a file delimiter?

550