|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
sequence in procedure (better question)
OK, here is a much better version of the procedure. The only problem here (I think) is that 'emp_no_seq.currVal' is not allowed in the UPDATE commands. This seems like an easier problem to solve. Anybody?
oracle8 Code:
Last edited by pabloj : November 18th, 2005 at 08:21 AM. Reason: Added proper syntax highlighting |
|
#2
|
||||
|
||||
|
currVal is already in use, you should go for nextVal, or get currVal from the one that got it.
__________________
My blog Tutorials about OSS databases, DBMonster ... Contribute to OSS Development, fill bug reports! Developer Shed eSupport Commented my.ini/my.cnf (ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins Random data (with a bias) |
|
#3
|
|||
|
|||
|
I don't understand what you mean. Is there some kind of self-referencing keyword like 'this.' in Oracle, as in Java/C++? It also occured to me that it might be best to use an exception to handle the possibility of a duplicate key value but my text does not cover exceptions at all. I've done a little research online but haven't come up with a solution yet. Also, the use of a sequence value in 'where' clauses is prohibited, so that doesn't work either. I would really like to be able to assign emp_no_seq.nextVal to a variable that I could then use throughout the procedure, but that doesn't seem to be allowed either. My text is really incomplete. Here is the latest version of the procedure. I think I have the exception written correctly but there is still the problem with the UPDATE commands.
PS. How'd you get the Oracle tags? PHP Code:
|
|
#4
|
|||
|
|||
|
He means once you got emp_no to be the next sequence number use the emp_no variable, don't use the sequence. Sequences cannot be depended on to have a constant value.
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > sequence in procedure (better question) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|