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 rename in sql?

726


How bulk collect improves performance?

740


what is 'mysqlimport'? : Sql dba

721


What is cursor in pl sql?

763


Can we create a trigger on view?

666






How much ram can sql express use?

699


Write the command to remove all players named sachin from the players table.

922


What is the difference between the conventional and direct path loads? : aql loader

900


1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins

1321


How to raise user-defined exception with custom sqlerrm ?

857


can sql servers linked to other servers like oracle? : Sql dba

749


Explain the methods used to protect source code of pl/sql.

732


what is self join and what is the requirement of self join? : Sql dba

851


How is use pl and sql?

732


What are the steps for performance tuning.

1034