I would change the PTable data type from char to varchar. Change ID from integer to number. I use "IS" instead of "AS" but that and the other 2 changes I suggested do not really matter. I just do not see any problem with your PL/SQL code. Can you trace what the actual value of PTabla is? What happens if you add...
SELECT count(*) INTO nKount FROM TBRHUIDS where Tabla = PTabla;
...before you try the update in your procedure code below? (add "nKount OUT NUMBER" to your list of procedure parameters before trying this and initialize nKount to zero in your code).
>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
Mark McCasland
Midlothian, TX USA