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: SQL*Plus and PL/SQL >> how to get a last row from the table?

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: how to get a last row from the table?
 aus  Posted: Feb 13, 2008 09:57:31 AM

 Total Post: 10
 Joined: Dec, 2007






 hai friends i want to get a last row`s values from table?how can i achieve that?especially i need to get recently updated values from the last row of a table,because i have to maintain that all the old values also... here i need to take exact one values from last row`s cell which i want to get...is it possible or not?


 Murtuja
Posted: Feb 13, 2008 11:19:36 PM  

 Total Post: 857
 Joined: Jan, 2006






 
You must have any column where you can give "ORDER BY" .Otherwise you can't get last row inserted because database doesn't maintain any order for insert.


select * from (select * from table order by col desc ) where rownum <2

 imran
Posted: Feb 14, 2008 06:24:50 AM  

 Total Post: 3
 Joined: Feb, 2008






 
Hi,
You can use this query to fetch last row of the database.

Select * from emp where rowid=(select max(rowid) from emp);

 Garlapati
Posted: Feb 19, 2008 05:28:45 AM  

 Total Post: 30
 Joined: Apr, 2007






 
select * from tmp_raj
where rowid in(select max(rowid) from tmp_raj)

 newuser
Posted: Feb 21, 2008 06:18:37 AM  

 Total Post: 10
 Joined: Feb, 2008






 
hi,

hope this will solve


SELECT * FROM EMP WHERE ROWNUM < 2
ORDER by EMPno desc

Thanks,
Nagaraj

 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 Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi334
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






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