Accessing the very last record in a transparent table.

Hi!
There's any way to read the last record of a transparent table?
My problem is:
I have to access the very las record of a Z table because I need the maximun value of a numeric field (that is the first field of the primary key).
I used a SELECT MAX, with no condition , but I was asked to find a more performance solution.
There is any way to access the last record of a table? Something like we have for the internal tables with the READ TABLE INDEX N, but with a select statement?
Thanks a lot for your help!

Yes, that was my first thought, but I made a comparising between both options with SE30.
Check this numbers:
TIME:  11,377,702
select * from t100 into table t_t100.
sort t_t100 descending.
read table t_t100 index 1.
TIME: 954,218
DATA: MAX_MSGNR type t100-msgnr.
SELECT MAX( MSGNR ) FROM T100 INTO max_msgnr.
Select MAX is better...
I don't think there is a better solucion... Maybe a big brain here has an idea...
Vasanth, thanks for your quick reply!

Similar Messages

  • Oracle OLEDB driver can't postion at the very first record if ....

    Hi, all:
    It seems that I found a serious bug with OLEDB provider 8.1.7.3.
    For the following two queries, the provider works properly.
    select * from emp
    select * from emp, account
    However, the provider can't reposition to the very first record after navigating some records with the following query.
    select * from emp, account, dept
    Notify that MS Oracle provider still works correctly.
    Regards,
    Yuancai (Charlie) Ye
    Fast accessing all of remote data sources anywhere with SocketPro using
    batch/queue, non-blocking and parallel computation
    See 30 well-tested and real OLEDB examples
    at http://www.udaparts.com

    Quote
    Originally posted by wonkanoby
    what motherboard
    tried clearing cmos
    I thought i had mentioned that but it seems I didn't. :P
    It's the K7T Pro.  Same as the post listed above.
    According to my friend he's had it for more than 3 years so the warrantee is gone and I dont' see anything MSI can do.
    I came across many posts on the forums about the K7t Pro and it's successors.
    Everyone is says the same thing, "a bad voltage regulator.... leaky capacitors..."
    I've eliminated the following things as causes for this problem...
    PSU
    CMOS
    CPU
    RAM
    VideoCard
    SoundCard
    NIC
    Cooling
    The only things I am not sure of is the motherboard and the fact the D-Leds point to something with the lithium batter, as I mentioned above.
    Have there been problems with these motherboards like people say?
    Can you or anyone else think of anything which maybe causing this?

  • How to get the last record of an internall table ....

    Hi All..
    i want to get the last record of an internal table itab, and i want the the value of the last record.

    Hi,
         Use describe statment.
    data: lv_line type i.
        Describe table itab lines lv_line.
        read table itab into wa_itab index lv_line.
    regards,
    Santosh Thorat

  • PLEASE HELP!! I've used iWeb to create multiple sites, all published to third party servers.  The very last site I made changes to is showing up in any domain file I open - despite their different names and locations on my iMac.  I just switched to Lion.

    Please HELP!!  I just switched to Lion.  I have created multiple websites using iWeb  3.0.4 and despite my having saved their 'domain' files in various locations and using different filenames, upon opening the domain files I keep getting the very last site I published.  All the sites were published to third party servers.  The domain files (still have a preview that look correct and have different file sizes) but keep going back to the last site published. HELP ME PLEASE!! Are the old files still available?!!

    In Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.
    To open your domain file in Lion or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • TS1135 Cannot process the Photo Book; it fails always at the very last stage with "error occurred while uploading on of your files. Pls check your network connection and click Retry..." Tried at 12 times and no joy!  Can anyone help?

    Can anyone help with the Photo Book process?  I have tried at least a dozen times and the Photo Book always fails at the very last stage of the process.  I ordered Buy Book, it assembles the book and files are transferred until the very last moment... it says " An error occurred while uoloading one of your files.  Please check your network connection and click Retry to resend your files."   It fails every time, any advice?  My server is TalkTalk which may explain everything !! ??   Help.

    Boot into Safe Mode, Mac OS X: Starting up in Safe Mode, and order from there. 
    Also make a PDF file of your book according to this Apple Document, iPhoto '11: Preview a book, card, or calendar before you order or print it, before you order to check for errors.  Keep that file to compare with the printed copy when it arrives.
    OT

  • TS2516 an error occurred uploading my iPhoto Book order. It puts the book together and starts to send but at the very last moment comes up with an error message. but checking the book in iPhoto there are no problems to be found.

    an error occurred uploading my iPhoto Book order. It puts the book together and starts to send but at the very last moment comes up with an error message. but checking the book in iPhoto there are no problems to be found.

    This user talked to Apple Support personnel and confirms what Larry is suggesting:
    crowland1066
    Re: book upload fails
    Nov 30, 2013 3:02 PM (in response to pablo123)
    Just got off the phone with apple support.  If the photo book completes the assembly process but fails during the upload process the problem is in their overloaded servers.They just started a free shipping promotion for the holidays which has increased the traffic dramatically. I bought a calendar a week ago and it went right through. I'm going to try again during less peak times.
    Happy Holidays

  • Spilt the number of records in a internal table

    Hi all,
            I have a requirement where i must spilt the number of records in my internal table itab .Say if i have 2000 records , i must spilt it taking the first 990 records and doing some posting using Bapi and again take the next 990 records and do the posting .Can some one help me out.
    Good answers will be rewarded with points.

    Hi,
    You can use these instructions using two internal tables, but please be aware to not forget any line.
    REFRESH my_table2.
    APPEND LINES OF my_table FROM 1 TO 990 TO my_table2.
    CALL FUNCTION 'BAPI'....
                 (with my_table2)
    REFRESH my_table2.
    APPEND LINES OF my_table FROM 991 TO my_table2.
    CALL FUNCTION 'BAPI'....
                 (with my_table2)
    Regards,
    Mathieu

  • Store the vital info from the absence quota record in an internal table

    Hi experts,
    I want to detrmine if the Absence record’s (PA2001 rec) deduction from date (PA2001-BEGDA) and absence to date (PA2001-ENDDA) are permissible for the validity period of the Absence Quota record (the PA2006 rec).  If the quota’s deduction from date, PA2006-DESTA, is greater than the PA2001-BEGDA, we then need to identify this absence quota record for change and change the deduction from date, PA2006-DESTA, to be the same as PA2001-BEGDA.  Store the vital info from the absence quota record in an internal table and record the new date that the deduction from date that needs to be changed to.  The changes will be made via a BDC session.
    Please help me out...
    Thanks,
    Vicky

    This looks possible if we code it in 'dynamic action' table, but the BDC may not read it during run time.
    Do you still have this issue?
    Thanks
    Narasimha

  • When AD users accessed the group last time

    Suppose We have a Group 'A' which is under 'B' domain in Active Directory. 'B' domain is used by many applications.
    we have a website in which validations are done thro Acitve directory. That is it will allow to enter the site if that user is added to group 'A' under 'B' domain.
    I created a .NET application and it will fetch who all are having access to website & the user details from the AD. Last access date is not showing correctly.
    Tool will shows last logon date as today’s
    date & time when I logon to website now.
    If we are
    not accessed the website today but we connected to the system using 'B' domain today, then tool will display the last logon time as today’s date.
    Using .NET is there any way to filter the last accessed date for a group in a particular domain? Anyone can provide me the C#.NET code will be appreciated

    Please check this thread
    http://forums.asp.net/t/1274419.aspx?Get+Last+Logon+date+from+the+active+directory+using+C+
    There are two attributes for this in Active Directory:
    lastLogon refers to the last logon for the specific server you're querying. This date may be different for different servers (domain controllers), and for some it may be null/empty. This attribute is not replicated.
    lastLogonTimestamp refers to the last logon for all servers. This attribute is replicated, which means that all servers have the same value. Only problem is that the default synchronization is 14 days on this attribute which may be too long.

  • Need to fetch the last record/row from a table

    Hi,
    I have a requirement like fetching the closing balance of the last record of the table and inserting the same into the opening balance of the immediatetly created next record.
    In simple words, I need to fetch a value from the last row of the record.
    For example, I use the below query,
    select rownum, empno, ename from emp
    where rownum = (select count(rownum) from emp);
    But, the above query does not return any of the record.
    Hence, need help on this.
    Regards,
    Shivakumar A
    Edited by: shiva on Mar 27, 2011 10:14 PM

    Rows in a table are inherently unordered. In order to introduce the concept of "first" and "last", you would need to specify how to order the rows which would require that there was one or more columns in the table that you could order by in order to determine the "last" record.
    In your closing balance example, if we assume that there is something like a BALANCE_DATE column,
    SELECT account_number, balance_amount, balance_date
      FROM (
        SELECT account_number,
               balance_amount,
               balance_date,
               rank() over (partition by account_number order by balance_date desc) rnk
          FROM table_of_balances )
    WHERE rnk = 1Justin

  • Selecting the last record from a database table

    In my ABAP Program, I have to use a select statement to retrieve the last record from the database table with the same key.  In other words, the Program will get more than one hit on the database table for the selected keys and I need to retrieve values from only the last record and not the first.  I know I can use an internal table to sort the records first and then retrieve the right value.   But to make things easier, is there a SELECT statement keyword than I can use to do this in one single step?  Thanks!

    hi,
    tables:mara.
        data: begin of it_mara occurs 0,
                matnr like mara-matnr,
                meins like mara-meins,
                mtart like mara-mtart,
                end of it_mara.
    select-options:s_matnr for mara-matnr.
    select matnr
              meins
              mtart
    from mara
    into table it_mara
    where matnr in s_matnr.
    if not it_mara[] is initial.
    sort it_mara by matnr descending.
    read table it_mara index 1.
    endif.
    then you get the last record of the select statement.
    reward points if useful,
    venkat.

  • Always fill out the very last row of a table (which can expand)

    Hi, I'm having problems with a button in table A that adds a row to another table (table B) and then automatically fills out some of the table row data (table A) into the newly created row of the other table (table B)
    Here's my code (on click of button in a row of Table A) - I should also mention that Table A has a button to add more rows to itself:
    This almost works - however, it only works if the amount of rows in each table match - which they don't necessarily as the user may or may not opt to add the row from table A to table B. eg. Table A could be 4 rows deep, but table B may only contain 2 Rows.
    tableB.row.addInstance(0);
    var vCol1 = this.resolveNodes("tableA.row.cellA");
    var vCol2 = this.resolveNodes("tableB.row.cellA");
    var vCol3 = this.resolveNodes("tableA.row.cellB");
    var vCol4 = this.resolveNodes("tableB.row.cellB");
    for (var i = 0; i < vCol1.length; i ++) {
                 vCol2.item(i).rawValue = vCol1.item(i).rawValue;
                 vCol4.item(i).rawValue = vCol3.item(i).rawValue;
    I'm new to scripting (learning on the fly) so my question is, seeing that the first command is to add a new row to table B, can I alter the code so that var vCol2 and vCol4 always relate to the very latest row that has been created? In that way, any previous rows that have been added will shunt down the list and will not be affected but the new button click? Or is there a better way of doing this.

    Hi,
    I think the key here is that the addInstance method returns the row it has just added.  So your add can be something like;
    var button = xfa.host.messageBox("You are about to ADD this entry to Table B. Do you wish to proceed?", "Add to Table B Section", 1, 2);
    if (button == 4)
       var newRow = tableB._tableBrow.addInstance(0);
       newRow.cellA.rawValue = cellA.rawValue;
       newRow.cellB.rawValue = cellB.rawValue;
    I'm not sure how you want the table A remove button to work?  Should it remove the first table B row with a matching cellA and cellB?
    Regards
    Bruce

  • Multiple users accessing the same data in a global temp table

    I have a global temp table (GTT) defined with 'on commit preserve rows'. This table is accessed via a web page using ASP.NET. The application was designed so that every one that accessed the web page could only see their data in the GTT.
    We have just realized that the GTT doesn't appear to be empty as new web users use the application. I believe it has something to do with how ASP is connecting to the database. I only see one entry in the V$SESSION view even when multiple users are using the web page. I believe this single V$SESSION entry is causing only one GTT to be available at a time. Each user is inserting into / selecting out of the same GTT and their results are wrong.
    I'm the back end Oracle developer at this place and I'm having difficulty translating this issue to the front end ASP team. When this web page is accessed, I need it to start a new session, not reuse an existing session. I want to keep the same connection, but just start a new session... Now I'm losing it.. Like I said, I'm the back end guy and all this web/connection/pooling front end stuff is magic to me.
    The GTT isn't going to work unless we get new sessions. How do we do this?
    Thanks!

    DGS wrote:
    I have a global temp table (GTT) defined with 'on commit preserve rows'. This table is accessed via a web page using ASP.NET. The application was designed so that every one that accessed the web page could only see their data in the GTT.
    We have just realized that the GTT doesn't appear to be empty as new web users use the application. I believe it has something to do with how ASP is connecting to the database. I only see one entry in the V$SESSION view even when multiple users are using the web page. I believe this single V$SESSION entry is causing only one GTT to be available at a time. Each user is inserting into / selecting out of the same GTT and their results are wrong.
    I'm the back end Oracle developer at this place and I'm having difficulty translating this issue to the front end ASP team. When this web page is accessed, I need it to start a new session, not reuse an existing session. I want to keep the same connection, but just start a new session... Now I'm losing it.. Like I said, I'm the back end guy and all this web/connection/pooling front end stuff is magic to me.
    The GTT isn't going to work unless we get new sessions. How do we do this?
    Thanks!You may want to try changing your GTT to 'ON COMMIT DELETE ROWS' and have the .Net app use a transaction object.
    We had a similar problem and I found help in the following thread:
    Re: Global temp table problem w/ODP?
    All the best.

  • If there a way to restore my icloud from a backup other than the very last one?

    I deleted some pics before my last backup that I need back. Can someone please help me?

    Apple states that it keeps your last three iCloud backups.  During the process of restoring an iCloud backup, iCloud will show you which ones are available and ask you to select the one you want to restore (see image below).  You may need to tap "Show older backups" to access earlier ones.  The only way to find out if an earlier one is available is to go through the restore backup process.

  • Is my query the very last bit of sql sent through cfquery?

    I have Coldfusion 9 on a Windows Server 2008 box. I have a datasource that points to a Windows Server 2000 with SQL Server 2000. My goal with this template was to determine if my SQL server was recieving any traffic. We anticipate that one or two databases may have select statements being run against it. So, we figured we could use this template to produce proof of activity. (if a process's last query is different from the last one we logged, then that confirms that our sql server is still recieving activity)
    <cfquery name="processes" datasource=#dsn#>
        USE master
        SELECT * from sysprocesses where spid > 50
    </cfquery>
    <cfloop query="processes">
        <cfquery name="lastquery" datasource=#dsn#>
            DBCC INPUTBUFFER(#duckprocesses.spid#)
        </cfquery>
    You can see that I'm using DBCC INPUTBUFFER to determine what the last query was. Utilizing the field called #lastquery.eventinfo# I was hoping to see some queries connected to our datasource. After testing however, I am not getting any proof of my coldfusion server sending sql to my sql server. The queries were successful, because they returned data to my test coldfusion  page, but I couldn't find my query in the inputbuffer command. I know it works, because my sql server queries (run locally on the sql server) returned some results and would properly show up after using the INPUTBUFFER command. However, when I send some queries via <CFQUERY> I do not see the queries in the inputbuffer command.  I do see the following "SET TRANSACTION ISOLATION LEVEL READ COMMITTED" next to the IP address of my Coldfusion server. So that leads me to believe that there is some transactional safety inherit with coldfusion.
    Does coldfusion send ONLY my query to the database server or does it also come inherit with some transactional sql? Like when your CFM throws an error after a <cfquery>INSERT some rows here</cfquery> and the inserted rows do not show up because an error was thrown a few lines down?

    I suggest that you look closely at the MySQL function library reference material for the version of MySQL that you are running ... and, consider upgrading if you need to.
    In any case, you might be able to get more precision by asking for it, e.g. with the CAST() and CONVERT() functions.
    The MySQL documentation (as recently as 5.0) discusses precision math functions.
    Most significantly, though, it seems that MySQL now offers a library of geo-spatial (GIS) functions which might make it possible for you to go well beyond the Pythagorean Theorem in addressing your problem.  The boundaries of each ZIP Code are, of course, a closed polygon, and what you are really looking for here is to determine containment of a chosen point within this and/or adjacent polygons.  MySQL 5.0, for instance, appears to have considerable direct support for this.  You do have to purchase these data sets.
    See:  http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html

Maybe you are looking for