Find out the latest row inserted
Hi,
I just want a statement to find the latest record inseted in a table, for example I inserted a record with trans_id=001202 this is not sequence and i don't remember the trans_id and i want to retrieve this record.
Please let know the statement at the earliest.
Thanks
Srinvias
I got the coorect record by using rowid not rownum.
Any way thanks for your helpRowid will not guarantee that you get the last record either. Oracle will reuse rowid's of deleted records. Look at the following example:
SQL> create table test(c1 varchar2(8))
2 storage(initial 8k next 8k);
Table created.
SQL> insert into test values('aaaaaaaa');
1 row created.
SQL> insert into test values('bbbbbbbb');
1 row created.
SQL> insert into test values('cccccccc');
1 row created.
SQL> insert into test values('dddddddd');
1 row created.
SQL> insert into test values('eeeeeeee');
1 row created.
SQL> insert into test values('ffffffff');
1 row created.
SQL> insert into test values('gggggggg');
1 row created.
SQL> insert into test values('hhhhhhhh');
1 row created.
SQL> insert into test values('iiiiiiii');
1 row created.
SQL> commit;
Commit complete.
SQL> select max(rowid) from test;
MAX(ROWID)
AAABgpAAFAAAZMqAAI
SQL> select rowid,c1 from test;
ROWID C1
AAABgpAAFAAAZMqAAA aaaaaaaa
AAABgpAAFAAAZMqAAB bbbbbbbb
AAABgpAAFAAAZMqAAC cccccccc
AAABgpAAFAAAZMqAAD dddddddd
AAABgpAAFAAAZMqAAE eeeeeeee
AAABgpAAFAAAZMqAAF ffffffff
AAABgpAAFAAAZMqAAG gggggggg
AAABgpAAFAAAZMqAAH hhhhhhhh
AAABgpAAFAAAZMqAAI iiiiiiii <--- at this point the last record inserted has the max(rowid)
9 rows selected.
SQL> delete from test where c1 < 'hhhhhhhh';
7 rows deleted.
SQL> commit;
Commit complete.
SQL> insert into test values('jjjjjjjj');
1 row created.
SQL> insert into test values('kkkkkkkk');
1 row created.
SQL> insert into test values('llllllll');
1 row created.
SQL> insert into test values('mmmmmmmm');
1 row created.
SQL> insert into test values('nnnnnnnn');
1 row created.
SQL> insert into test values('oooooooo');
1 row created.
SQL> insert into test values('pppppppp');
1 row created.
SQL> insert into test values('qqqqqqqq');
1 row created.
SQL> commit;
Commit complete.
SQL> select max(rowid) from test;
MAX(ROWID)
AAABgpAAFAAAZMqAAJ
SQL> select rowid,c1 from test;
ROWID C1
AAABgpAAFAAAZMqAAA kkkkkkkk
AAABgpAAFAAAZMqAAB llllllll
AAABgpAAFAAAZMqAAC mmmmmmmm
AAABgpAAFAAAZMqAAD nnnnnnnn
AAABgpAAFAAAZMqAAE oooooooo
AAABgpAAFAAAZMqAAF pppppppp
AAABgpAAFAAAZMqAAG qqqqqqqq <--- this is the last inserted value
AAABgpAAFAAAZMqAAH hhhhhhhh
AAABgpAAFAAAZMqAAI iiiiiiii
AAABgpAAFAAAZMqAAJ jjjjjjjj <--- this value has the max(rowid)
10 rows selected.
SQL>
Similar Messages
-
Hi ,
How to find out the latest Record in per_all_people_f and per_all_assignments_f
Requirement : Need to find out the latest record in per_all_people_f and per_all_assignments_f to update the attribute column with pre defined value . Its not possible to track only with person_id / assignment_id and effective end date
SELECT pp_id
FROM (SELECT app.person_id pp_id,
asf.*
FROM apps.per_all_people_f app,
apps.per_all_assignments_f asf
WHERE --app.person_id=123568 and
asf.person_id = app.person_id AND
app.effective_end_date = to_date('31-dec-4712') AND
asf.effective_end_date = to_date('31-dec-4712')
GROUP BY app.person_id)
HAVING COUNT(pp_id) > 1
GROUP BY pp_id
This query also returns more than 1 value for person_id .
It would be great if you put comment on this .. Thanks in advance ,
AryaI am getting more records with asf.primary_flag='Y' . If you give ur mail id , i will send the sample data
ASSIGNMENT_ID EFFECTIVE_START_DATE EFFECTIVE_END_DATE BUSINESS_GROUP_ID RECRUITER_ID GRADE_ID POSITION_ID JOB_ID ASSIGNMENT_STATUS_TYPE_ID PAYROLL_ID LOCATION_ID PERSON_REFERRED_BY_ID SUPERVISOR_ID SPECIAL_CEILING_STEP_ID PERSON_ID RECRUITMENT_ACTIVITY_ID SOURCE_ORGANIZATION_ID ORGANIZATION_ID PEOPLE_GROUP_ID SOFT_CODING_KEYFLEX_ID VACANCY_ID PAY_BASIS_ID ASSIGNMENT_SEQUENCE ASSIGNMENT_TYPE PRIMARY_FLAG APPLICATION_ID ASSIGNMENT_NUMBER CHANGE_REASON COMMENT_ID DATE_PROBATION_END DEFAULT_CODE_COMB_ID EMPLOYMENT_CATEGORY FREQUENCY INTERNAL_ADDRESS_LINE MANAGER_FLAG NORMAL_HOURS PERF_REVIEW_PERIOD PERF_REVIEW_PERIOD_FREQUENCY PERIOD_OF_SERVICE_ID PROBATION_PERIOD PROBATION_UNIT SAL_REVIEW_PERIOD SAL_REVIEW_PERIOD_FREQUENCY SET_OF_BOOKS_ID SOURCE_TYPE TIME_NORMAL_FINISH TIME_NORMAL_START BARGAINING_UNIT_CODE LABOUR_UNION_MEMBER_FLAG HOURLY_SALARIED_CODE REQUEST_ID PROGRAM_APPLICATION_ID PROGRAM_ID PROGRAM_UPDATE_DATE ASS_ATTRIBUTE_CATEGORY ASS_ATTRIBUTE1 ASS_ATTRIBUTE2 ASS_ATTRIBUTE3 ASS_ATTRIBUTE4 ASS_ATTRIBUTE5 ASS_ATTRIBUTE6 ASS_ATTRIBUTE7 ASS_ATTRIBUTE8 ASS_ATTRIBUTE9 ASS_ATTRIBUTE10 ASS_ATTRIBUTE11 ASS_ATTRIBUTE12 ASS_ATTRIBUTE13 ASS_ATTRIBUTE14 ASS_ATTRIBUTE15 ASS_ATTRIBUTE16 ASS_ATTRIBUTE17 ASS_ATTRIBUTE18 ASS_ATTRIBUTE19 ASS_ATTRIBUTE20 ASS_ATTRIBUTE21 ASS_ATTRIBUTE22 ASS_ATTRIBUTE23 ASS_ATTRIBUTE24 ASS_ATTRIBUTE25 ASS_ATTRIBUTE26 ASS_ATTRIBUTE27 ASS_ATTRIBUTE28 ASS_ATTRIBUTE29 ASS_ATTRIBUTE30 LAST_UPDATE_DATE LAST_UPDATED_BY LAST_UPDATE_LOGIN CREATED_BY CREATION_DATE TITLE OBJECT_VERSION_NUMBER
931510 7-Nov-08 31-Dec-12 122 (null) (null) (null) 3978 1 (null) 14402 (null) 220150 (null) 734956 (null) (null) 476 (null) (null) (null) (null) 2 E Y (null) 100035417-2 (null) (null) (null) 45948739 (null) (null) (null) (null) (null) (null) (null) 868007 (null) (null) (null) (null) 449 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null)
797386 26-Aug-08 26-Aug-08 122 (null) (null) (null) 3980 3 (null) 14402 (null) 218925 (null) 734956 (null) (null) 476 (null) (null) (null) (null) 1 E Y (null) 100035417 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) 740071 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null)
916076 26-Aug-08 31-Dec-12 122 (null) (null) (null) 3980 1 4 14402 (null) 218925 (null) 734956 (null) (null) 476 (null) (null) (null) (null) 1 B Y (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null)
797386 25-Feb-08 25-Aug-08 122 (null) (null) (null) 3980 1 (null) 14402 (null) 218925 (null) 734956 (null) (null) 476 (null) (null) (null) (null) 1 E Y (null) 100035417 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) 740071 (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) (null) -
To find out the last row that is updated in a View Object
Hi OAF Gurus,
I have requirement like,
I have to find out the last row that is updated on a particular View Object and I have send a mail to the users about the change.
JegSAMassMobVOImpl vo = getJegSAMassMobVO1();
JegSAMassMobVO is the View Object Name and it displays certain rows that has already been added to the VO in the Page.
Now the issue is when a user updates a particular row,I have to find which row gets updated and have to send a email to that particular employee about the change.
Just want to know,how to find out the last updated row in a particular VO.
Any Help would be appreciated as this a immediate requirement.
Regards,
Magesh.M.K.
Edited by: user1393742 on May 4, 2011 1:06 AMHi Magesh
It shoud be a Advanced table ,so when user will update the row ,the specific row will fire the PPR and on that event u can capture the row using row reference ,this is the sample code below
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean); OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
String event = pageContext.getParameter("event");
if ("<ItemPPREventName>").equals(event))
// Get the identifier of the PPR event source row
String rowReference =
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable[] parameters = { rowReference };
// Pass the rowReference to a "handler" method in the application module.
262
am.invokeMethod("<handleSomeEvent>", parameters);
In your application module's "handler" method, add the following code to access the source row:
OARow row = (OARow)findRowByRef(rowReference);
if (row != null)
Thanks
Pratap -
How can i find the latest row inserted in a table
i have a table with five columns and there is no primary key and everyday 100's of rows will be inserted to this table ,infact by mistake i have inserted a row and i just want to find out which is the last row i have inserted in to this particular table is there any way to find out this please......
That's not guaranteed to give you the latest row added to the table. Oracle could place new rows anywhere depending on what happened to rows in the table previously, what space is available in the tablespace etc etc:
SQL> create sequence dt_test_rowid_seq start with 1 increment by 1;
Sequence created.
SQL>--generate some test data
SQL> CREATE TABLE dt_test_rowid as
2 select object_id,
3 object_name,
4 dt_test_rowid_seq.nextval ins_sequence
5 from
6 dba_objects
7 where
8 object_id is not null
9 and
10 rownum <10000;
Table created.
SQL>--here, the latest addition to the table....
SQL> select max(ins_sequence) from dt_test_rowid;
MAX(INS_SEQUENCE)
9999
SQL>... reflects the highest rowid
SQL> select ins_sequence from dt_test_rowid where rowid=(select max(rowid) from dt_test_rowid);
INS_SEQUENCE
9999
SQL>--get rid of a load of rows
SQL> delete from dt_test_rowid where mod(object_id,2)=0;
2521 rows deleted.
SQL>--insert a load more
SQL> insert into dt_test_rowid
2 select object_id,
3 object_name,
4 dt_test_rowid_seq.nextval ins_sequence
5 from
6 dba_objects
7 where
8 object_id is not null
9 and
10 rownum <1000;
999 rows created.
SQL>--and here the latest addition to the table...
SQL> select max(ins_sequence) from dt_test_rowid;
MAX(INS_SEQUENCE)
10998
SQL>--...is NOT reflected by the highest rowid
SQL> select ins_sequence from dt_test_rowid where rowid=(select max(rowid) from dt_test_rowid);
INS_SEQUENCE
9999 -
How can I find out the new row.
I use below coding to create a new row,
row =vo.createRow();
vo.insertRow(row);
row.setNewRowState(Row.STATUS_INITIALIZED);
My question is how I can find out it later?
thx.If you have just inserted one row, then getCurrentRow should work.
in case you have inserted multiple rows after doing a setattribute, or setting the PK values in EOImpl, then you would need to loop through the VO and find the ro that matches the values using getAttribue method.
Thanks
Tapash -
How to find out the latest changes in Planning Book
HI Experts,
Please let me know, is there any way to find out who has changed the values in Planning Book and when ??Hi Srini,
We also have a similar requirement wherein we want to know who has changed the values in DP. Fortunately we have an additional key figure, which we are not using at the moment. We intend to write a macro wherein we can copy the key figure that is to be monitored copied in that new key figure at every exit of the planning book(exit macro). When the old value is changed, we will copy the old value in the new key figure (using an exit macro) and also generate an data base alert which will help us to capture the details of the change, that is, user id, time of change and the quantity of change.
Let me know if this suggestion suits your requirement.
Rgds, Sandeep -
Could u help me find out the latest version of Brtools
Hi Team,
We have BRTOOLS 6.40 (15) in BW 3.5 Version system which is 64 bit Unicode placed on an AIX server with Oracle database installed. Could u lemme know the latest version available in the market.
Thanks and Regards,
Priyanka RavishankarHi. Go to http:
service.sap.com\swdc --> downloads --> Support Packages and Patches --> Entry by Application Group --.>SAP NetWeaver --> SAP NETWEAVER -->SAP NETWEAVER 04 -->Entry by Component --> Application Server ABAP --> Choose your Kernel release --> example : SAP KERNEL 6.40 64-BIT UNICODE -->
AIX 64bit --> ORACLE --> DBATL640O92_48-20000227.SAR DBATOOLS Package for Oracle 9.2.x --> this pakage contains the BRTOOLS.
P.S. I'm now chek in your message AIX 64 bit U, and change the paths to store. Regards.
Edited by: Sergo Beradze on Apr 18, 2008 2:07 PM -
How can i find out the latest info about iPhone etc? when's the next update
Does anyone know wether the iphone will soon be able to foward text messages?
Even if you had purchased an iPhone prior to the 2nd generation iPhone being released, this would not have prevented you from purchasing the 2nd generation and activating it with your O2 account, and selling your existing iPhone.
The 18 month contract is not tied to a particular iPhone - at least not with at&t in the U.S. If my iPhone was lost or stolen, and I purchased another iPhone as a replacement, I could activate the new iPhone with my existing at&t account under my current contract without having to sign a new two year contract on the new iPhone's activation date, and without any penalty. The iPhone is not subsidized by the cellular provider in the typical way.
No point in your purchasing an iPhone from the U.S. anyway. The iPhone is sold in the U.S. as carrier locked with at&t only. The only way you could use an iPhone purchased in the U.S. with O2, or with any other GSM network provider besides at&t is by hacking the iPhone to unlock it. Doing so is against Apple's license agreement for the iPhone, it not supported by Apple, voids the warranty, and will prevent you from installing future iPhone updates, or at least until the hack used is update to be compatible with a new update. The same applies when Restoring an iPhone if needed or wanted.
Since you live in the UK, and if you don't have any problems with O2 as a provider, you will be much better off purchasing an iPhone sold in the UK, which is sold by Apple in the UK as carrier locked with O2 only. -
How can I find out the first intial row in VA02-output transaction??
How can I find out the first intial row in the screen which appears during sales order change (VA02) >>enter the sales order number >>after the first screen appears >>in the menu bar go to EXTRAS>>OUTPUT>>HEADER>>EDIT??
I have to find out the first row in the OUTPUT column which is empty,then populate it with some data using BDC.
usefull answers will be rewarded.
regards,
Shashank .Pass the sale order number in the object key of NAST table,
if u get 3 entires, then u need to place ur entry in the fourth row in that table control thru BDC.
I think u got the logic.
Regards,
Sujatha. -
Hi,
I am trying to find out the latest delivery date(EINDT) for each purchasing document (EBELN) through graphical way.
The view contains other fields apart from the above mentioned two fields.
When only the two fields (EBELN, EINDT) are there, then in semantics, I can select 'Max' as aggregation to get the maximum value for each document.
If I do like this, then I need to join more than 3 views and also so many joins in calculation view. Taking so much time for data preview.
Hence , please help me in getting the solution while the view contains other fields also.
Thanks in advance.
Thanks,
JyothirmayiHi Sreehari/Vinoth,
Thank you for your replies.
if only two fields are then I can get the max/min values of one field corresponding to other field.
But more than two fields are there with different values, then let me know how to find out the max/min value of a particular filed corresponding to the 2nd field with other fields also should be in the output.
I hope you understood my issue.Please revert in case of questions.
Thanks & Regards,
Jyothirmayi -
How to find out the rows inserted between a time period.
Hi,
Please help me to solve this.
Table - emp.
Colmns - empno(Primary Key),ename, mgr
How to find out the rows inserted between a time period.
For eg:- Between 02-Oct-2006 1 PM and 03-Oct-2006 2 PM.
regards,
Mathew.Hi,
Maybe work:
For each row, ORA_ROWSCN returns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. It is not absolutely precise, because Oracle tracks SCNs by transaction committed for the block in which the row resides
e.g.:
SGMS@ORACLE10> create table test(cod number);
Table created.
SGMS@ORACLE10> insert into test values (1);
1 row created.
SGMS@ORACLE10> insert into test values (2);
1 row created.
SGMS@ORACLE10> commit;
Commit complete.
SGMS@ORACLE10> insert into test values (3);
1 row created.
SGMS@ORACLE10> commit;
Commit complete.
SGMS@ORACLE10> select SCN_TO_TIMESTAMP(ora_rowscn),ora_rowscn,cod from test;
SCN_TO_TIMESTAMP(ORA_ROWSCN) ORA_ROWSCN COD
06/11/06 08:56:56,000000000 727707205 1
06/11/06 08:56:56,000000000 727707205 2
06/11/06 08:57:05,000000000 727707210 3Cheers -
How to find out the n number of records inserted??
In File to JDBC Scenarios, i am inserting n records in Oracle.
How to find out the n number of records inserted??Hi,
If you are using the statement "UPDATE_INSERT", get the response on element <insert_count>count</insert_count>. It will give you the inserted rows.
This link can be very helpfull.
[http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm]
regards.
roberti -
How can I find out the place from where a record is being inserted in table
Hi,
I want to find out the exact code statement from the SAP code from where record is being inserted into a SAP table. I tried ST05 SQL trace but it seems to only give the SQL statement and not the program from where it is being fired (unless you guys can show me a way to find it from the trace)
I m trying to see that when sales order is changed in VA02, from which piece of code in SAP the tables CDHDR and CDPOS get update. Also I tried using SE30 but it doesnt seem to give the results properly. Please help.
Thanks for readingHello Srikrishna,
Did you try the following?
In your trace with ST05:
i) Find the line that you are interested, right-click and select 'Display ABAP Source'.
OR
ii) Go to Trace List menu and click 'Summarize Trace by SQL Statement'. Then here, select the line you want and again right click to see 'Display ABAP Source'.
Regards,
Guven. -
Where do i go on my iPhone 5S to find out the precis moment of my latest iCloud back-up ?
Where do i go on my iPhone 5S to find out the precis moment of my latest iCloud back-up ?
Go to Settings>iCloud>Backup, then scroll to the bottom and look under "Back Up Now" for the date/time of your latest backup.
-
How do find out the number of rows
how to find out the number of rows of as all tables in a schema with one sql statement
Hi,
What u can try doing is...
declare
numrows number;
begin
for i in (select tname from tab)
loop
execute immideate 'select count(1) into numrows from ' | | i.tname ;
dbms_output.put_line(numrows);
end loop;
end;
Hope this helps. This works only in 8i. So if u need to do the same in 8.0 u have to use dbms_sql pkg.
The logic is same but the way u open ands execute the code is a bit diff.
Best Of Luck.
Regards,
Ganesh R
Maybe you are looking for
-
Switchboard performance reports
I have CUCM 7.1.3 and I'm trying to locate something in CAR to report on how many calls are being abandoned. Customers are complaining that no one is answering the phone and the operator are saying they never miss a call. Any help is appreciated. T
-
Request for Webcenter demo (viewlets) for Mobile devices (PDA/iPhone)
Hi , We are working on a deal opportunity for webcenter suite. We are looking for a demo artifacts (recording/viewlets/live vm) for webcenter integration with mobile devices (pda/ iPhones etc). Please advise. Thanks and regards Rahul
-
Every time i restart an old version of skype loads even though i have a new version installed
The old application shows up on my desktop also and no matter how many times i drag it to trash, it comes back up at restart. So i think that is the problem.
-
I have looked into getting Aperture to watch a folder so it will automatically import any new files, but am not having much success. I'm not shooting while tethered to a camera. I have a folder that contains all my images, in their various sub-folder
-
hi, anyone knows where to set and merge all the subforms? Currently in my layout subforms are in different page. If I hide the subform in runtime, the next subform will go up or from second page it will fo to the first page where the hidden subform i