Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: Oracle Certified Professional Exams (OCP & OCA) >> select query

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: select query
 meena  Posted: May 08, 2007 02:02:52 AM

 Total Post: 7
 Joined: Mar, 2007






 Hi,

I have following query: this is not working:

what i need is to pull pos-grp(POSITION CODE), title(NAME OF POSITION) as of 21-mar-2005.

this is just a rough query .can someone help.


SELECT DISTINCT POS_GROUP,POS_TITLE,POS_STATUS_DATE
FROM TBLPOS_H WHERE PERSON_ID = x
AND POS_STATUS_DATE as of '21-MAR-2005'

i tried one more way b y giving this :

SELECT DISTINCT POS_GROUP,POS_TITLE,POS_STATUS_DATE
FROM TBLPOS_H WHERE PERSON_ID = 3288214
AND POS_STATUS_DATE < = '21-MAR-2005'
ORDER BY POS_STATUS_DATE DESC

In this i need only the first row bcos that will fetch me the postion as of 21-mar-2005 but i am not sure what to use. i mean if give FETCH ONE ROW ONLY,its giving error.

thanks,
Meenal.

 parth
Posted: May 08, 2007 09:52:25 AM  

 Total Post: 17
 Joined: Apr, 2007






 
yes, you can always select your record in Descending order and while doing so just make that column combine with ROWNUM or ROWID and find it max(rownum) or max(rowid) and you will always get the latest record for that DATE. and always first record for that matter of fact.

~Parth

 parth
Posted: May 08, 2007 10:00:12 AM  

 Total Post: 17
 Joined: Apr, 2007






 
select rownum,ename from scott.emp
where rownum = (select max(rownum) from scott.emp where hiredate = '01/may/1981')


Probably this gives the answer, as far as i understand your problem

~Parth

 meena
Posted: May 10, 2007 12:58:43 AM  

 Total Post: 7
 Joined: Mar, 2007






 
thanks for the answer.

But i did not do in that way.

i declared a cursor and took the first row.

Thnaks,
meenal

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar814
  Mohammed Taj694
  Jayanta Sur479
  Vigyan Kaushik386
  positive fanatic361
  Gitesh Trivedi322
  Gopu Gopi239
  neeraj sharma228
  Ramesh Jois226
  snehalatha p169






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software