Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with RETURNING clause
Message
De
27/09/2005 12:54:17
 
 
À
Tous
Information générale
Forum:
Oracle
Catégorie:
PL/SQL
Titre:
Problem with RETURNING clause
Divers
Thread ID:
01053538
Message ID:
01053538
Vues:
47
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform