suppose we have values like 1 5 7 in a colum.Now we want
numbers like(2 3 4 6) that exists between 1 5 7.How can we
do this using sql query??
Answer Posted / krishna
This Query shall do the trick.
SQL> desc a;
Name Null? Type
------------------------------- -------- ----
A NUMBER(2)
SQL> select * from a;
A
---------
1
5
7
SQL> select x from (
2 select rownum x from all_tables ) a, (select max(a)
mx, min(a) mi from a) b
3 where a.x between b.mi and b.mx
4 and a.x not in (select * from a)
5 /
X
---------
2
3
4
6
SQL>
| Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
What is difference between stored function and application function?
Why commit is not used in triggers?
What is compilation error in pl sql?
Is a view faster than a stored procedure?
Define commit, rollback and savepoint?
how tsql statements can be written and submitted to the database engine? : Transact sql
What is the use of non clustered index?
Which one is better subquery or joins?
define sql update statement ? : Sql dba
What do you mean by query optimization?
Can one improve the performance of sql*loader? : aql loader
What are the benefits of pl sql?
What are the parts of a basic sql query?
Define overloaded procedure?
How do you explain an index?