473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to find last row and last column of table?

1
Hi all,

I am new to thescripts. Please assist me.

How to find lastrow and lastcolumn of a table in oracle?
Apr 10 '07 #1
3 13597
masdi2t
37
Hi all,

I am new to thescripts. Please assist me.

How to find lastrow and lastcolumn of a table in oracle?
lastrow:

SELECT * FROM your_table WHERE rownum=1 ORDER BY your_auto_increment_field DESC

lastcolumn (i don't get it why you need this information). this is the last column's name, not column's data

SELECT coumn_name FROM user_tab_cols WHERE table_name = your_table AND column_id = (SELECT max(column_id) FROM user_tab_cols WHERE table_name = your_table)
Apr 13 '07 #2
SELECT column_name FROM table_name WHERE rowid=(SELECT MAX(rowid) FROM table_name)
Mar 17 '10 #3
Well it depends a lot on how you define "last".

Since - per definition - there is no ordering in a relational table, it is defined by your ORDER BY clause.

so ORDER BY <your_criteria> DESC and fetch the row with rownum = 1
Mar 21 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Peter Foti | last post by:
Hi all, I have a form that contains a 2 column table. In the left column is the description for a particular input (ie - "First Name", "Last Name", "Phone Number", etc.). In the right column...
3
by: Adam | last post by:
Hello, How to find a last day of the next week (or in next two weeks) using VB.NET? for example: 01-Feb-2005 = 13-Feb-2005 or 09-May-2005 = 22-May-2005
3
by: NV | last post by:
I've a table called GReg with the fields GNumber, ControlNumber, ArticleCode, ProdNumber and Date. In a form I select the ArticleCode from one combo box, and I define the number of records to...
2
by: Hymer | last post by:
Hello, I have a small two-column table with three rows. The first column has a logo and the second column has the name of the organization. The logo's in the first column are too high. That...
5
by: Hymer | last post by:
Hello, I have a small two-column table with three rows. The first column has a logo and the second column has the name of the organization. The logo's in the first column are too high. That...
10
by: ste | last post by:
Hi there, I'm trying to query a MySQL database (containing image data) and to output the results in a HTML table of 3 columns wide (and however many rows it takes) in order to create a basic...
0
by: ralan | last post by:
Greetings Is there a way to use SQL in MS SQL Server 2005 to determine the last time a table was written to ? Thanks. alan
1
by: akress | last post by:
Hiya, I'm trying to convert a table with 6 colums that looks like this: <table class="myTable" width="640px"> <tr> <td><a href="#"> <img src="../_img/announce.gif" align="middle"...
1
by: Veeru71 | last post by:
Is there anyway to figure out when the REORG was run last on a table/ index ? We are using DB2 V 9.x. Thanks.
9
code green
by: code green | last post by:
When I run this query SELECT * FROM WHERE OrderDetail. = 244791 I get the required data along with an extra row. This extra row is the last in the table and is not a true data entry, nor do I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.