Hi All,
I was just going through EMP table in oracle Scott schema.
Say, I want to find out the first employee in alphabetical order who's name starts with 'A'. the following query gives me the desired result:
[code=oracle]
SELECT *
FROM ( SELECT ENAME
FROM EMP
WHERE UPPER(ENAME) LIKE 'A%'
ORDER BY ENAME ASC
)
WHERE ROWNUM=1
[/code]
Now if i want to find out the second employee in alphabetical order who's name starts with 'A'. I modified the query as:
[code=oracle]
SELECT *
FROM ( SELECT ENAME
FROM EMP
WHERE UPPER(ENAME) LIKE 'A%'
ORDER BY ENAME ASC
)
WHERE ROWNUM=2
[/code]
But this does not give me any rows although there are many employees whos names start with 'A'.
Please let me know what could be the problem in this case.
Thanks,
Pradeep
I was just going through EMP table in oracle Scott schema.
Say, I want to find out the first employee in alphabetical order who's name starts with 'A'. the following query gives me the desired result:
[code=oracle]
SELECT *
FROM ( SELECT ENAME
FROM EMP
WHERE UPPER(ENAME) LIKE 'A%'
ORDER BY ENAME ASC
)
WHERE ROWNUM=1
[/code]
Now if i want to find out the second employee in alphabetical order who's name starts with 'A'. I modified the query as:
[code=oracle]
SELECT *
FROM ( SELECT ENAME
FROM EMP
WHERE UPPER(ENAME) LIKE 'A%'
ORDER BY ENAME ASC
)
WHERE ROWNUM=2
[/code]
But this does not give me any rows although there are many employees whos names start with 'A'.
Please let me know what could be the problem in this case.
Thanks,
Pradeep
Comment