How to know the last inserted rows (database 10g)

Dear administrators,

could you please tell me how to query a table and even inserted datetime?

in fact, I have a table and I need to know the date and the last inserted rows.

The database is 10g

Thanks in advance

Elijah

Published by: user644597 on January 8, 2009 14:17

Published by: user644597 on January 8, 2009 14:17

Seems very late right now.
You can take a look at the standard function SCN_TO_TIMESTAMP (doc link below), but be aware, the results are NOT 100% guaranteed to be right:
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions142.htm#SQLRF06325

Nicolas.

Tags: Database

Similar Questions

  • Double insert into, how to get the last insert id

    Hi all

    I need to insert some values into 2 tables, and on the second Board, I put the last id inserted in the first table. I actually did more the thing, but it does not work:

    insert into ADDRESS (id, street, neighborhood, zip code, city, idcountry, phonenumber, fax, phone, mail, post number) values (",", ",", ",", "," "," ");
    insert into samplecenter (ID, idaddress, samplecentername) values (", * IDENT_CURRENT ('ADDRESS') *,"GENERAL - CO");

    -What someone could help me.

    Thank you very much.
    Jarod.

    You must use a sequence.

    for example

    create sequence address_seq
    minvalue 1
    maxvalue 1000000000000000
    start with 1
    increment by 1
    nocache;
    
    insert into ADDRESS (id, street, area, zipcode, town, idcountry, phonenumber, faxnumber, gsm, mail, post)
      SELECT
             address_seq.NEXTVAL,'','','', '', '', '', '', '', '', ''
        FROM dual;
    
    insert into samplecenter (ID, idaddress, samplecentername) values ('',address_seq.CURRVAL,'GENERALE - CO');
    
  • How to get the IP address, Port database don't & Oracle SID details

    Hello
    How to know the IP address, Port database don't & Oracle SID details

    Hello

    The IP address is for not for the database server.

    Port no, may be different.

    check what sid, listening to the port

    lsnrctl > status

    or

    Open the tnsname.ora or listener.ora to find what hostname(ip address), what is the port number and what is the SID that you connect

    Hope that answers your question.

    Kind regards
    Rakesh Jayappa

  • How to find the last date of execution of the objects in database

    Hi all

    We're going for an upgrade of the database 11g and for the same thing, we want to know the last date of the following-

    Packages, Tables, views
    Conc. programs / value Sets / look up / profile options

    Is there a way we can find the same thing.
    The answers would be really useful.

    Kind regards
    Shruti

    So can you provide clues on how to find the last opportunity registration

    I don't think you can find such a script with having activated audit.

    Thank you
    Hussein

  • How to determine the number of rows in the database and save the result to a local variable?

    Hello

    I'm a newbie in the use of TestStand, databases and SQL, and now I've met difficulties. I use TestStand 2014 (32 bit).

    I have a need to know the number of rows in a database and save that number in a local variable. I tried to practice using the database of the Types of step provided with TS. I tried to use the following in a SQL statement:

    Locals.NumberOfRows = ("SELECT COUNT (*) FROM TEST_TABLE")

    It returns an error: specified value is not the expected type. My goal is possible in this way, or I'm doing this completely wrong?

    -RautSa

    Thank you for your response, Norbert. I have a database of who wins new values at random, and sometimes I need the exact number of rows in this table.

    I managed to achieve my goal by using the SQL statement: "SELECT COUNT (*) as Rowcount OF TEST_TABLE", followed by a data GET operation, which records that number of lines in a local variable.

    -RautSa

  • How to know the database uses pfile or spfile?

    Hi guru

    How to know the database uses pfile or spfile?



    Thank you

    Thank you for this question of doc!
    Please type in sql * show spfile parameter.
    If it is empty, you do not use a spfile.

    --------------
    Sybrand Bakker
    Senior Oracle DBA

  • How to know the degree of optimal parallelism for my database?

    I have an important application on my (Oracle 10,2,0) databae and the box has 4 CPU. All tables are not partitioned. Should I set the parallel degree by myself?

    How to know the degree of optimal parallelism for my database?

    As far as I am concerned there is no optimum degree of parallelism at the database level. The optimal value depends on the query based on the plan in use. This may change over time.

    It is not so difficult to abuse of the PQO and end up harming the overall database performance. PQO is a brute force methodology and should be applied with caution. Otherwise, you end up with results inconsisten.

    You can let Oracle manage, or you can manage it on the level of education through advice. I do not have to specify the degrees of parallelism to the object level. As I said, no two queries are exactly alike and what is right for a query on a table cannot be good for another query on the table.

    In the case of doubt put in place the system to let Oracle manage. If you ask really, it's how many sessions to allocate PQO then look at your reports Statspack or AWR and judge your system load. Monitor v$ px_session and v$ pq_slave to see how these views show activity.

    IMHO - Mark D Powell-

  • How to find the last pasted paragraphs FMP?

    I'm sticking FMP several objects at once in a file (a file of changes to the sections containing the changebars) in the main text flow. I want a separator line to go at the end of each pasted section, so I try to insert one after the paste operation. But instead of a line between each section, all lines are added at the end of the file, after all the sections. So if there are 3 glued sections at the end of the file are three lines. My code is below, do you know how I could fix this?

    Thank you, Mark

    function copyPasteChanges (doc, chgRange) {}

    Select the section with changebar and copy it.

    doc. TextSelection = chgRange;

    doc. Copy();

    Prepare for the changes doc and paste there the modified section.

    var firstChgPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;

    var changesTloc = new TextLoc (firstChgPgf, Constants.FV_OBJ_END_OFFSET);

    var changesTRange = new TextRange (changesTloc, changesTloc);

    changesDoc.TextSelection = changesTRange;

    changesDoc.Paste ();

    To go at the end of the file again (I think)

    var lastPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;

    var dividerPgf = changesDoc.NewSeriesPgf (lastPgf);

    var TLoc = new TextLoc (dividerPgf, 0);

    changesDoc.AddText (TLoc, '_');

    }

    Hi Mark,

    The problem is that the dough does not occur when you think. The dividing line is added at the end of the file, but are not your actions of dough. Actually, I think that maybe a little random where pasta is produced, because this line:

    var changesTloc = new TextLoc (firstChgPgf, Constants.FV_OBJ_END_OFFSET);

    .. .is does not create a valid text location. You can check this by abandoning the service after:

    changesDoc.TextSelection = changesTRange;

    .. and look at where's the insertion point. It will probably be everywhere where you left it last, because the call is not valid. I can't tell you exactly why, except that it has something to do with the fact that you are using the last paragraph in the stream. There is something weird to try to define a range of full-paragraph text with the last paragraph. I'm sure it's related to how the last TFP in a stream does not show a mark of FMP, but beyond that, I don't know how to do what you're trying to do with the last paragraph.

    Having no knowledge of how do it right, any time I need to do this, I create a paragraph "dummy" at the end of the flow to fill that space strange 'last FMP", then do the work around it. In the end, I just want to remove fake TFP. I don't know if it's a good idea or not, but it's the only way I ever get it to work and it sorts the mirror how you could do this manually in the GUI.

    With this, I modified your script as follows, and it seems to work better. Note that I also modified the logic of how to find the last paragraph of the flow by writing a separate function. Your call to the 'FirstTextFrameInFlow' is OK, unless your doc begins to span several pages and/or begins with several empty pages. The function I wrote ensures that you really the last TFP in the stream.

    I hope this helps.

    Russ

    function copyPasteChanges (doc, chgRange) {}

    Select the section with changebar and copy it.

    doc. TextSelection = chgRange;

    doc. Copy();

    Prepare for the changes doc and paste there the modified section.

    var lastPgf = getLastPgf (changesDoc);

    var dummyPgf = changesDoc.NewSeriesPgf (lastPgf);

    var changesTloc = new TextLoc (dummyPgf, 0);

    var changesTRange = new TextRange (changesTloc, changesTloc);

    changesDoc.TextSelection = changesTRange;

    changesDoc.Paste ();

    To go at the end of the file again (I think)

    Don't forget that last TFP is now fake TFP

    lastPgf = getLastPgf (changesDoc);

    var dividerPgf = changesDoc.NewSeriesPgf (lastPgf.PrevPgfInFlow);

    var TLoc = new TextLoc (dividerPgf, 0);

    changesDoc.AddText (TLoc, '_');

    dummyPgf.Delete ();

    }

    function getLastPgf (doc)

    {

    textFrame var is doc. MainFlowInDoc.LastTextFrameInFlow;

    var lastPgf = textFrame.LastPgf;

    While (! lastPgf.ObjectValid () & textFrame.ObjectValid ())

    {

    textFrame = textFrame.PrevTextFrameInFlow;

    lastPgf = textFrame.LastPgf;

    }

    Return lastPgf;

    }

  • Mr President, how to find the last DML operations

    Hello

    Please tell me how to find the last DML operations at least a minimum of 30 queries.

    Thanks in advance,

    Select sql_id, sql_text, last_load_Time from V$ SQLAREA

    or

    Select * from v$ sqltext

    Must be one of them. But don't know what exactly you are looking at.

    I usually use v$ sqlarea to see recent queries.

    Maybe you can limit the rows using rownum, order of last_load_time.

    I understand, if the same query is used again then only recent transaction is stored.

  • How to know the Version of the installed hotfix

    Hello

    How I don't know the last Version of the Patch installed my database in the Windows Oracle 9.2.0.8 version.

    in Opatch lsinventory only displeays list of bugs fixed in the current patchh.

    Kind regards

    ABK

    Published by: Abk on May 11, 2009 10:59

    [oraprod@erpdev OPatch] $ sqlplus "/ as sysdba".

    SQL * more: release 9.2.0.6.0 - Production on Mon May 11 11:33:51 2009

    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    With partitioning, OLAP and Oracle Data Mining options
    Release 9.2.0.6.0 - Production jserver

    SQL > select * from v version $;

    BANNER
    ----------------------------------------------------------------
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE 9.2.0.6.0 Production
    AMT for Linux: release 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production

    SQL > exit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    With partitioning, OLAP and Oracle Data Mining options
    Release 9.2.0.6.0 - Production jserver
    [oraprod@erpdev OPatch] $ opatch lsinventory

    Setup Oracle interim Patch version 1.0.0.0.55
    Copyright (c) 2006 Oracle Corporation. All rights reserved...

    We recommend that you check the OPatch documentation under
    OPatch/docs for reference to use. We also recommend that you use
    the latest version of OPatch. To get the latest version of OPatch
    and other support related issues, please refer to the document
    293369.1, which is visible from metalink.comp.com

    Home Oracle = /u01/compprod/oaproddb/9.2.0
    Location of Oracle Universal Installer = /u01/compprod/oaproddb/9.2.0/oui components
    Location of OraInstaller.jar = "/ u01/compprod/oaproddb/9.2.0/oui/jlib".
    Universal Oracle install a shared library = /u01/compprod/oaproddb/9.2.0/oui/lib/linux/liboraInstaller.so
    Location of the pointer of the Oracle inventory = /etc/oraInst.loc
    Location of Oracle = /u01/compprod/oaproddb/9.2.0/inventory inventory
    Path to the Java = /u01/compprod/oaproddb/9.2.0/jre/1.4.2/bin/java
    Logfile = /u01/compprod/oaproddb/9.2.0/.patch_storage/*.log

    Creation of log file "/ u01/compprod/oaproddb/9.2.0/.patch_storage/LsInventory__05-11-2009_11-34-08.log".

    Result:

    Installed the Patch list:
    =====================
    1) patch 4751921 applied on Tue Feb 21 10:38:16 IST 2006
    [Bug (s) of base: 4006711 4141415 4609041 4081624 4017526 3804515 4285404 3910149 4157713 4642417 3922760 4049345 4080972 3467622 4409067 4275680 4735715 3747472 3865608 4098853 3990826 4460898 3857781 3737955 4149579 4288876 4131501 3799696 3626323 4230880 4039237 3680704 4751921 4430748 4156916 3691672 4078745 4337747 3817792 4754836 4567846 3859298 4567969 4570100 4011643 4161315 4015165 2701372 3119415 4608731 4353077 4064791 3834770 4093187 3830972 4193295 3258674 4523976 4519477 4523979 2448994 4488790 3389359 3898338 4698691 4161400 4200029 4112254 3940412 4242561 4230189 4050649 4199440 3285454 4450964 4392392 3624684] 3949307 4248629 4392396 4336997]
    2) patch 3984255 applied on Wed Jul 13 07:11:08 IST 2005
    [Bug (s) base: 3984255]
    3) patch 4385803 applied on Wed Jul 13 07:10:45 IST 2005
    [Bug (s) base: 4385803]
    4) patch 4252938 applied on Wed Jul 13 07:10:10 IST 2005
    [Bug (s) base: 4252938 3787344 3669454]
    5) 4167403 patch applied on Wed Jul 13 07:09:30 IST 2005
    [Bug (s) base: 4167403]
    6) 3682068 patch applied on Wed Jul 13 07:08:32 IST 2005
    [Bug (s) base: 3682068]
    7) 3202151 patch applied on Wed Jul 13 07:07:54 IST 2005
    [Bug (s) base: 3202151]
    8) 3900237 patch applied on Wed Jul 13 07:04:47 IST 2005
    [Bug (s) base: 3900237]
    9) 3794402 patch applied on Wed Jul 13 07:04:12 IST 2005
    [Bug (s) base: 3794402]
    10) patch 2785957 applied on Wed Jul 13 07:03:01 IST 2005
    [Bug (s) base: 2785957]

    OPatch succeeded.
    [oraprod@erpdev OPatch] $

    Published by: Florent on May 11, 2009 11:44

  • How to know the schema of BIEE instance repository

    I have several BIEE instance and equivalent manner several repositories created by RCU. How to know the link between the repository and POET?

    Thank you

    Take a look on


    $FMW_HOME/user_projects/domains/bifoundation_domain/config/jdbc/mds-owsm-jdbc.xml

    The jdbc-driver-params shows you the database and the schema that it uses, which tells you what you want to know.

  • How to get the last day of a month for every 2 months for a given period?

    Hello

    Can is it some please let me know how to get the last day, last day of the week, the weekend last day, last Monday, one month for every 2 months for a given period?

    Thanks in advance.

    Try the below

    SELECT LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))) lastday.

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'SAT '.

    SO LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-1

    WHERE TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'Sun '.

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-2

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    END as lastweekday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') IN ('Sam', 'SUN')

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    -(TO_NUMBER (TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))),' from)) - 1).

    END as lastweekendday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'MY

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER NEXT_DAY (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), "LUN")-7

    END AS lastmonday

    FROM (SELECT SYSDATE startdate,

    SYSDATE + 300 enddate

    THE DOUBLE)

    CONNECT BY LEVEL<=>

  • How to get the last DML statement in each block

    Hello

    How can I get the latest DML statements in each block.
    As SYSTEM. LAST_QUERY returns the last select statement, I need to get the last Insert/Update/Delete statement
    in each block.

    Thanks in advance

    Rizly

    Rizly,

    You can use the GET_BLOCK_PROPERTY to get the last query executed on this block.

         MESSAGE(GET_BLOCK_PROPERTY('', LAST_QUERY));
    

    Kind regards

    Manu.

    If this answer is useful or appropriate, please mark. Thank you.

  • I forgot my password for windows 7... and please tell me how to know the password to open with?

    I forgot my password for windows 7... and please tell me how to know the password to open with?

    I forgot my password for windows 7... and please tell me how to know the password to open with?

    Keep passwords secure - Microsoft on passwords strategy
    http://support.Microsoft.com/kb/189126

    What to do if you forget your Windows password:
    http://Windows.Microsoft.com/en-us/Windows-Vista/what-to-do-if-you-forget-your-Windows-password

  • How to know the product key for windows7

    How to know the product key for windows7

    Look for the COA sticker attached to your computer, usually downstairs or in the battery compartment if it of a laptop and is preinstalled on your computer. Or upper/side if it's a desktop computer.

    If you bought Windows 7 from the Microsoft Store:

    Find your key product if your purchase of Microsoft Store:
    http://store.Microsoft.com/Help/FAQ?Err=T2#AT2

    You can find your Windows product key on the label supplied with the package provided with your copy of Windows

Maybe you are looking for