tag:blogger.com,1999:blog-1271763227002553835.post2092921424563887192..comments2024-03-26T08:42:34.744+01:00Comments on Notes on Oracle: Identifying the "last" record using the LEAD functionAlex Nuijtenhttp://www.blogger.com/profile/06345615264010120428noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-1271763227002553835.post-52616955201347879082021-03-03T08:49:18.032+01:002021-03-03T08:49:18.032+01:00Pretty nifty indeed!! Thanks! Save me hours! Pretty nifty indeed!! Thanks! Save me hours! TommyDhttps://www.blogger.com/profile/15877983915304406504noreply@blogger.comtag:blogger.com,1999:blog-1271763227002553835.post-29876354212347161192018-09-28T19:53:09.678+02:002018-09-28T19:53:09.678+02:00The original will work with not null columns (Prim...The original will work with not null columns (Primary key). If you are checking another column that allows NULLS, you may get a 'Yes' but it may not be the last row :)Anonymoushttps://www.blogger.com/profile/04620456157478951155noreply@blogger.comtag:blogger.com,1999:blog-1271763227002553835.post-21950924132523463112015-08-15T11:02:40.444+02:002015-08-15T11:02:40.444+02:00Tx for the post Alex.
Of course you know about row...Tx for the post Alex.<br />Of course you know about row_number. Do you have any performance indicators that compare different ways to determine "last record" ?Mennanhttps://www.blogger.com/profile/17200742738844544493noreply@blogger.comtag:blogger.com,1999:blog-1271763227002553835.post-24686685225456188862013-09-16T09:32:05.482+02:002013-09-16T09:32:05.482+02:00This blogpost is about pure Oracle SQL, not about ...This blogpost is about pure Oracle SQL, not about Java (I assume that's what your code snippet is).. Keep data related functionality as close to the data as you can - that's what I believe...Alex Nuijtenhttps://www.blogger.com/profile/06345615264010120428noreply@blogger.comtag:blogger.com,1999:blog-1271763227002553835.post-12998213900110074202013-09-15T17:31:40.069+02:002013-09-15T17:31:40.069+02:00There is also another simple way to make use of in...There is also another simple way to make use of inbuilt method last(). Here is the solution<br /><br />First you need to make the result set scrollable as well as updatable. Updatable means, you directly insert into result set. Then you can use the .last() method, or .absolute(int row) method to move through the result set. Make the following changes.<br /><br />Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);<br /><br />You are done. Use the last()method, it won't throw any exception, Your code will work like charm<br />Kohinoornoreply@blogger.comtag:blogger.com,1999:blog-1271763227002553835.post-47279571266228186032013-03-05T03:49:56.692+01:002013-03-05T03:49:56.692+01:00Thanks for this post. It was useful to identify a...Thanks for this post. It was useful to identify and discard the last row of my query. Bellhttps://www.blogger.com/profile/02150725178080164615noreply@blogger.comtag:blogger.com,1999:blog-1271763227002553835.post-79035944449015330262013-01-02T05:34:02.290+01:002013-01-02T05:34:02.290+01:00I did not know arguments of lead function and was ...I did not know arguments of lead function and was using "case when .... is null" to identify the last row. This article help simplify my code a lot. Thank you!Anonymoushttps://www.blogger.com/profile/02185193077274781179noreply@blogger.comtag:blogger.com,1999:blog-1271763227002553835.post-84789589557159469392011-06-27T20:47:16.284+02:002011-06-27T20:47:16.284+02:00Wonderful post! This is very useful to many reader...Wonderful post! This is very useful to many readers like me. Being a student, I am requiring myself <br />to read articles more often and your writing just caught my interest. Thank you so much!viagra onlinehttp://www.iservepharmacy.com/noreply@blogger.com