Last updated record in a table

Hello guys,.

I have a huge table with it are NOT of any field with date or date and time.
I just want to know what was the last record inserted and updated in this table? Oracle stores the timestamp of each record. How to retrieve by using the SQL query?

My database is 10gr 2 and Linux is the operating system.

Kind regards
Imran

I have a huge table with it are NOT of any field with date or date and time.
I just want to know what was the last record inserted and updated in this table? Oracle stores the timestamp of each record. How to retrieve by using the SQL query?

My database is 10gr 2 and Linux is the operating system.

Visit this link

http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1590655700346557237

Tags: Database

Similar Questions

  • Need to retrieve the last line/record in a table

    Hello

    I have a requirement like getting the ending balance of the last record in the table and the same insertion in the opening balance of the immediatetly created the next record.

    In simple terms, I need to extract a value from the last line of the recording.

    For example, I use the query below

    Select rownum emp, empno, ename
    where rownum = (select count (rownum) from emp);

    But, the above query does not return all of the recording.

    Therefore, need help on this.

    Kind regards
    Shivakumar has

    Published by: shiva March 27, 2011 22:14

    Hello
    Strictly speaking there is no such LAST or FIRST folder until that order you them.
    But check the following:

    SELECT * FROM emp MINUS
    SELECT * FROM emp WHERE rownum<=(SELECT count(empno)-1 FROM emp);
    

    Kind regards
    Lakshmi.

  • Select the last 10 records in a table

    Oracle9i. I am trying to select the last 10 numbers in a table with this command series
    select serial from tab_42 where employeecode='00001'  and rownum<=10 order by serial desc;
    but it's not not selecting the most recent serial number 10. How to do?

    The rownum clause is applied before the order by clause, one must use a subquery...

    select * from (select serial from tab_42 where employeecode='00001' order by serial desc) where rownum<=10;
    
  • How to select the last 3 records in a table?

    I have a table named HRM_ATTENDANCE
    as follows
    Name         Type         Nullable Default Comments 
    ------------ ------------ -------- ------- -------- 
    LEAVEDATE    DATE                                   
    EMPLOYEECODE VARCHAR2(8)                            
    LEAVETYPE    VARCHAR2(4)                            
    APPROVEDBY   VARCHAR2(8)  Y                         
    FEEDBY       VARCHAR2(8)  Y                         
    FEEDTIME     DATE         Y                         
    REMARKS      VARCHAR2(50) Y 
    the table contains the record of leave of employees as follows
    LEAVEDATE   EMPLOYEECODE LEAVETYPE APPROVEDBY FEEDBY   FEEDTIME    REMARKS
    ----------- ------------ --------- ---------- -------- ----------- --------------------------------------------------
    6/1/2013    00001        CL  
    6/3/2013    00001        EL                                         
    6/5/2013    00001        CPL    
    6/7/2013    00001        SL 
    6/9/2013    00001        CL                                        
    I want to select the last 3 leaves (records) to employeecode "00001" so I don't know the what are the dates of the leave. in easy words I want to choose the folder where leavedate > = 5 June 2013 ", but I don't know any dates."

    Select * from HRM_ATTENDANCE where rownum<=3 order="" by="" leavedate="">

  • Last files N in a table

    Hi Experts, how to extract the last N records from a table without altering the order of records?

    Thanks in advance...

    Hello

    2763326 wrote:

    Hello

    Sorry, I was on vacation and could not answer soon.

    I went through the discussion that happened. Thank you all for your time.

    I clarify my question as below:

    The emp table I get two last records i.e., registration of FORD and MILLER

    EMPNO, ENAME JOB MGR, HIREDATE SAL COMM DEPTNO

    ------ ---------- --------- ---------- --------- ---------- ---------- ----------

    7369 SMITH CLERK 7902 DECEMBER 17, 80 800 20
    7499 ALLEN SELLER 7698 FEBRUARY 20, 81 1600 300 30
    7521 WARD SELLER 7698 FEBRUARY 22, 81 1250 500 30
    7566 JONES MANAGER 7839 2 APRIL 81 2975 20
    7654 MARTIN SELLER 7698 28 - SEP - 81 1250 1400 30
    7698 BLAKE MANAGER 7839 1 MAY 81 2850 30
    7782 CLARK MANAGER 7839 JUNE 9, 81 2450 10
    7788 SCOTT ANALYST 7566 APRIL 19, 87 3000 20
    KING 7839 PRESIDENT NOVEMBER 17, 81 5000 10
    7844 TURNER SELLER 7698 08 - SEP - 81 1500 0 30
    7876 ADAMS CLERK 7788 MAY 23, 87 1100 20
    JAMES 7900 CLERK 7698 DECEMBER 3, 81 950 30
    7902 FORD ANALYST 7566 DECEMBER 3, 81 3000 20
    7934 MILLER CLERK 7782 JANUARY 23, 82 1300 10

    OUTPUT:

    7902 FORD ANALYST 7566 DECEMBER 3, 81 3000 20
    7934 MILLER CLERK 7782 JANUARY 23, 82 1300 10

    Is it possible to get this result from the discussion I see that oracle does not maintain insertion order unless you have a specific column to keep track of changes and insertions.

    Thanks in advance

    Ravi

    Of course; If you can tell which way these 2 rows are the last 2: can someone show you how do it.

    They are the last 2 in order by empno?  If so:

    WITH got_r_num AS

    (

    SELECT ename, empno, mgr, hiredate, sal, comm, deptno

    , EVALUATE () OVER (ORDER BY empno DESC) AS r_num

    FROM scott.emp

    )

    SELECT ename, empno, mgr, hiredate, sal, comm, deptno

    OF got_r_num

    WHERE r_num<=>

    ;

    Is this another thing that makes the last 2 rows?  If so, change the analytical ORDER BY clause.

  • Get the updated record the last based on the Date and the van of the user ID corresponding (multiple tables)

    Hello people,

    I currently have a working for this using PL/SQL solution, but it would be nice to have it using SQL. Any help is appreciated and once again, to your practice time.

    I'm looking to pick up the most recent date and the corresponding user that updated registration for a student in particular. There are two tables T1 and T2. The most recent date can be the create_date or modified_date of T1 or T2.

    Scripts for creating the table and INSERT statements:

    create table T1
      ( code           varchar2(4),
        create_date    date,
        create_userid  varchar2(20),
        modified_date  date,
        modify_userid  varchar2(20));
    
    create table T2
      ( code           varchar2(4),
        visit_id       number,
        visit_date     date,
        create_date    date,
        create_userid  varchar2(20),
        modified_date  date,
        modify_userid  varchar2(20));
    
    

    insert into T1 values ('1001',to_date('06-FEB-2013 09:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-APR-2013 13:01:12','DD-MON-YYYY HH24:Mi:SS'),'BRIAN');
    insert into T2 values ('1001',1,to_date('10-JAN-2013','DD-MON-YYYY'), to_date('10-JAN-2013 14:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-MAR-2013 12:01:06','DD-MON-YYYY HH24:Mi:SS'),'AMY');
    insert into T2 values ('1001',2,to_date('31-JAN-2013','DD-MON-YYYY'), to_date('12-MAY-2013 16:11:12','DD-MON-YYYY HH24:Mi:SS'),'GRACIE',null,null);
    
    insert into T1 values ('1002',to_date('12-JAN-2013 11:12:13','DD-MON-YYYY HH24:Mi:SS'),'LYNNELLE',to_date('12-APR-2013 13:01:12','DD-MON-YYYY HH24:Mi:SS'),'BRIAN');
    insert into T2 values ('1002',1,to_date('10-JAN-2012','DD-MON-YYYY'), to_date('10-JAN-2012 09:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-APR-2013 13:04:12','DD-MON-YYYY HH24:Mi:SS'),'AMY');
    insert into T2 values ('1002',2,to_date('10-JAN-2013','DD-MON-YYYY'), to_date('12-JAN-2013 11:12:13','DD-MON-YYYY HH24:Mi:SS'),'JOHN',null,null);
    
    insert into T1 values ('1003', to_date('04-FEB-2014 12:01:01', 'DD-MON-YYYY HH24:Mi:SS'), 'LYNNELLE', null, null);
    
    

    I want to show for the three codes are the following records:

    Code      Table Date                              User ID
    1001      T2  12-MAY-2013 16:11:12   GRACIE
    1002      T2 12-APR-2013 13:04:12   AMY
    1003 T1 04-FEB-2014 12:01:01 LYNNELLE
    
    

    1001 students, the most recent is the create_date of the visit count = 2 for the Code 1002, the most recent date comes from modified_date for visit 1 (its 3 seconds later than the T1 modified_date). Finally, for students 1003 (who did not all records in T2, the create_date is the only date and must be picked up.

    Thanks in advance.

    with t as)

    Select the code,

    NVL (MODIFIED_DATE, create_date) dt.

    case nvl (modified_date, create_date)

    When modified_date then modify_userid

    of other create_userid

    end userid,

    Tbl "T1".

    from t1

    Union of all the

    Select the code,

    NVL (MODIFIED_DATE, create_date) dt.

    case nvl (modified_date, create_date)

    When modified_date then modify_userid

    of other create_userid

    end userid,

    Tbl 'T2 '.

    the t2

    )

    Select the code,

    Max (TBL) keep (dense_rank last order by dt, tbl) tbl.

    Max (DT) dt,

    Max (UserID) keep (dense_rank last order by dt, tbl) userid

    t

    Code group

    order by code

    /

    CODE TO DT USERID
    ---- -- -------------------- --------------------
    1001 T2 MAY 12, 2013 16:11:12 GRACIE
    1002 T2 12 APRIL 2013 13:04:12 AMY
    1003 T1 4 FEBRUARY 2014 12:01:01 MANON

    SQL >

    SY.

  • Update the records in the table

    I have an INCOME_LOT table. Now, I need to update records with the current max (lot_id) + rownum where lot_id = 0.
    Note: There are multiple records with lot_id = 0.

    CREATE TABLE INCOME_LOT
    (
    LOT_ID NUMBER OF NON-NULL,
    NUMBER OF DETAIL_ID
    DATE OF EFFECTIVE_DATE,
    DATE OF UPDATE_DATE
    )
    It is only a sample data of 4 records, while in fact, I have millions of records to be updated.

    Insert into INCOME_LOT
    (LOT_ID, DETAIL_ID, EFFECTIVE_DATE, UPDATE_DATE)
    Values
    (0, 5773490, TO_DATE (MAY 5, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (MAY 6, 2014 00:22:40 ',' DD/MM/YYYY HH24:MI:SS'));))
    Insert into INCOME_LOT
    (LOT_ID, DETAIL_ID, EFFECTIVE_DATE, UPDATE_DATE)
    Values
    (0, 5773491, TO_DATE (MAY 5, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (MAY 6, 2014 00:22:40 ',' DD/MM/YYYY HH24:MI:SS'));))
    Insert into INCOME_LOT
    (LOT_ID, DETAIL_ID, EFFECTIVE_DATE, UPDATE_DATE)
    Values
    (0, 5773492, TO_DATE (MAY 5, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (MAY 6, 2014 00:22:40 ',' DD/MM/YYYY HH24:MI:SS'));))
    Insert into INCOME_LOT
    (LOT_ID, DETAIL_ID, EFFECTIVE_DATE, UPDATE_DATE)
    Values
    (0, 5773493, TO_DATE (MAY 5, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (MAY 6, 2014 00:22:41 ',' DD/MM/YYYY HH24:MI:SS'));))
    COMMIT;

    Can someone help me to update all records with a single SQL query or maybe a PL/SQL block? I could design a cursor to update, but it would be tedious to use.

    Do you want this:

    UPDATE INCOME_LOT

    Set lot_id = 262696 + ROWNUM

    WHERE lot_id = 0;

  • With the last update, I am unable to merge cells in a table and Ive tried Split and Live view.

    With the last update, I am unable to merge cells in a table and Ive tried Split and viewing live, all the tutorial and manuals say to do in Design view, which is no longer available.  How to merge cells in a table now?

    To get the fashion Design back in a checkerboard to fluid...

    Close all other files, open the fluid grid css and add the X below:

    /*

    Properties Grid Dreamweaver fluid

    ----------------------------------

    DW-num-CLO-mobile: X 4;

    DW-num-CLO-Tablet: 8;

    DW-num-OCOL-Office: 12;

    DW-gutter-percentage: 25;

    =====================================

    Then save and close the file.

    DW restart and you should have mode Design from here out on all files using this fluid grid .css file.

  • Record in the table don't is not updated correctly after sail of detail page

    I have 2 jspx pages (page A) a table showing the employee record, another a (page B) is used to update the file of the selected employee. On the page, when the button select a folder and clicking on the 'details' I may be navigaed at pag B on which I can edit registration information in a form component. I have a table column 'Prospect', which applies to a LOV layer VO pageB I use < af:inputComboboxListOfValues > to display a combo of LOV for this attribute, when I enter a new value here and save it, I can go back to page one, but the name of the team for this record shows empty, by querying the database that I find the record updated successfully with the changed value. And when I reloaded the page this record may indicate the new team name value. Why it is not updated in the employee table, when browsing immediately return of page B? I put the table attribute to 'always', but always refresh iterator not. Can anyone help with this? Thank you!!

    BTW, for the other columns (not LOV), they are ok, the table can display the value correctly.

    Published by: user774592 on July 14, 2011 19:56

    Published by: user774592 on July 14, 2011 21:59

    What component to use to show as filed?

  • How to find inserted last record in the table.

    Version: Oracle 10g

    I have a table called 'Manufacturing' and 3 columns as mfno, itemname, quantity.
    How to find inserted last record in the table 'manufacturing '.

    As I got to know that the Rowid is not a result perfect result. Please provide your inputs.

    user13416294 wrote:
    Version: Oracle 10g

    This is not a version. It's a product name. A version is 10.1.0.2 or 10.2.0.4, etc.

    I have a table called 'Manufacturing' and 3 columns as mfno, itemname, quantity.
    How to find inserted last record in the table 'manufacturing '.

    Not possible as your data model do not answer for him. As simple as that.

    If there is a need to determine an order or associate some time to an entity, then that should be part of the data model - and a relationship, or one or several attributes are necessary to represent this information. Your data model in this case is therefore unable to meet your requirements.

    If the requirements are valid, set the data model. In other words - your question has nothing to do with Oracle and nothing to do with the other pseudo columns in Oracle, the rowscn or the rowid. It is a question of pure data modeling. Nothing more.

  • Recovery was last updated

    Hi Experts

    I use ODI 10.1.3.5

    We have a requirement like showing the last update of the data in the report.

    For this, I'll by the approach to get the last run of the scenarios.

    I had 2 tables i.e. SNP_SESSION, SNP_SESS_TASK_LOG, which stores a similar type of records, but could not go forward.

    Basically I'm looking for the extraction of the last run date/time for the table target/tables involved in a scenario.

    Please let me know if you count more details.

    Concerning
    Abdel Aziz

    Hi Abdel Aziz,

    Glad to know that it works.

    Please tag for each answer u get. It is a motivating factor for us people that helps u.

    Thank you
    Guru

  • How to insert the last updated date and user id to a form?

    Hello

    I created a form to enter data into a custom table.
    When a new record is created, I want to keep track of the date created, last updated date, and who (user id) enters the form.

    Can you please help or point me to a good place to look for this information?

    Thank you!
    LC

    Create four new columns in your table called Created_On, Created_By, Last_Updated_On and Last_Updated_By.

    You can create a trigger for the rest:

    create or replace trigger ""
      before insert or update on ""
      for each row
    begin
      if inserting then
        :NEW.Created_On := sysdate;
        :NEW.Created_By := v('APP_USER');
      end if;
    
      if updating then
        :NEW.Last_Updated_On := sysdate;
        :NEW.Last_Updated_By := v('APP_USER');
      end if;
    end;
    

    Whenever you will add or modify data in this table, the trigger will automatically fill these fields.

    Kind regards
    Mathieu

  • iPhone 6plus iOS 9.3.5 since the last update my touch screen is freezing. Has yet to be decided. Connection to the computer did not help. I had to wait my battery died to restart. Once restarted I could use touchscreen but it now

    Aggravated with the update from my iPhone

    It is a list of the problems I have with my iPhone 6plus since updating to IOS 9.3.5.

    1. A single date after update my touch screen froze and I was unable to trouble or to use until the battery died and the phone has rebooted.
    2. Since this restart my touch screen hangs for 5 minutes at a time at least 5 times per hour.
    3. My screen goes completely black 20 seconds in the reading of an article. I have to refresh my browser at least 6 times by reading an article on the web.
    4. If I'm in iBook I can't read yet a page without the screen goes black. I hit the home back to iBook button try to keep reading where I left off the coast, but within 20-30 seconds it goes back to black.
    5. While I'm typing, even this message, I hit the button of the space and the words are charged or inserted which does not appear. I myself taking much time to type anything bc I have to go back and get rid of the words that the phone has decided to him only to change or insert.
    6. Improvements that never going to this last day f__d my phone. Difficulty what you did in the last updated bc I will eventually lead to an Apple Store and throw the phone home.

    What have I tried to fix it. Everything. For many in the list and you already know what the normal things are that the average person would be difficult it phone. I have no problems until I updated to iOS more recent so caused my problems of telephones you people. PLEASE FIX NOW

    Thank you

    Debbie

    I posted my severe issue with the iphone since the last update August 28, 2016 at 12:27 and watch to see when your system has declared that I posted my question that I call a problem so I guess you can add that to my problems too. OH nothing automatic record is

  • Mozilla, your last update does not include the last cert of intermediaries of extended validation from Verisign, Symantec class 3 EV SSL CA - G2, please fix ASAP

    Your last update of firefox, Mozilla does not include the last cert of intermediaries of extended validation from Verisign, Symantec class 3 EV SSL CA - G2, please fix ASAP

    Firefox never includes the intermediate certificates.
    It is the responsibility of a server to include all the intermediate certificate required to make it possible to build a certificate chain that ends with a trusted root certificate embedded.

    Note that Firefox automatically records the intermediate certificates that servers send in certificates for future use Manager (they appear labelled as 'Software security device' in the References tab).
    If a server does not send a complete certificate chain then you get an untrusted error when Firefox has stored missing intermediate certificates to visit a server in the past that a send it, but you get an untrusted error if this intermediate certificate is not yet registered.

  • I can't choose to all my folders to bookmark a Web page, since your last update.

    I have several folders. However, now, when I click to bookmark a page, only a few folders appear in the list. So, I can't bookmark a page in the folder I want. (This seems to have started after your last update).
    How can I go back to the previous edition? Or, you can solve this problem?
    Thank you.

    This is not a problem with any 'update' - it's like that since Firefox 3 was released in mid-2008. There is place for five files in this window of little beast, until you click on the arrow to show more.

    This extension "corrects" this little window allowing you to parts of "drag" of this window to view a table like folders.
    https://addons.Mozilla.org/en-us/Firefox/addon/add-bookmark-here-2/

Maybe you are looking for