General information
Title:
Problem with RETURNING clause
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only