|
|
Re: last record....... [message #221176 is a reply to message #221173] |
Sat, 24 February 2007 13:28 |
rajat_chaudhary
Messages: 141 Registered: November 2006 Location: india
|
Senior Member |
|
|
according to u sir, if i will go for "order by" clause then it gives me according to ascending order not the last record but either by useing sql or by pl/sql ,i want only last record please try to give me result,,,,,,,,,,,,,,
i awaited for ur result /..............
|
|
|
|
|
Re: last record....... [message #221613 is a reply to message #221604] |
Tue, 27 February 2007 12:27 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Forms? So why did you post a question on Reports forum?
Basically, what you are saying is wrong. As long as it will be fine in a single-user environment, it is about to fail as soon as this form enters a multi-user environment. Why? Because, sooner or later, two users will run the same form at the same time and - using that trigger - create the same ID. For such a purpose, SEQUENCE is a better choice. You'd simply select sequence_name.nextval and that'll do it. This value can be obtained either in a form or using a database trigger.
Furthermore, your code can be written a little bit simplest:SELECT NVL(MAX(employee_id), 0) + 1
INTO something
FROM employees;
Finally, although I don't have neither 9.2.0.1.0 nor 9.1 to test it, I believe those versions are similar enough to support the code you've written.
|
|
|
|
|
|
|
|
Re: last record....... [message #221841 is a reply to message #221837] |
Wed, 28 February 2007 11:14 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
You seem to keep relying on false presumptions. Why do you insist on simple solutions which are wrong, instead of listening to advices which suggest you different, but correct approach to the solution of your problem?
|
|
|