Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with RETURNING clause
Message
From
27/09/2005 12:54:17
 
 
To
All
General information
Forum:
Oracle
Category:
PL/SQL
Title:
Problem with RETURNING clause
Miscellaneous
Thread ID:
01053538
Message ID:
01053538
Views:
43
Hello,
the following works ok in sql server, it gets a new ID for some table from a last ids table:

CREATE PROCEDURE NewId
@Tabla Char(15),
@ID Int output
AS
Update TBRHUIDS
Set LastID = LastID + 1
, @pnID = LastID + 1
Where Tabla = @Tabla


I need the Oracle equivalent, so I try:

CREATE OR REPLACE PROCEDURE NEWID
(PTabla in Char,
ID out Integer)
AS
begin
Update TBRHUIDS
Set LastID = LastID + 1
Where Tabla = PTabla returning LastID into ID;
commit;
end;


However, this gives a ORA-01422 error :exact fetch returns more than requested number of rows
However, there is only ONE record matching the where clause.

I know I could write a select statement after the update, but I need to guarentee that each concurrent access will get his own ID under heavy simultaneous accesses.
Oracle 8.1.7
Next
Reply
Map
View

Click here to load this message in the networking platform