Then I remove line with INSERT, function works.
I try select "spoziceID into lnSpoziceID from ..." with "for update nowait" without succes.
create or replace function kvak3
(lcPozice in char, lcDatum in char, lnHodnota1 in number, lnHodnota2 in number)
return number as lnUspech number :=-1;
Tally number :=0 ;
lnSpoziceID number :=0 ;
lnSdataID number :=0 ;
ldDatum date :=To_Date(lcDatum,'YYYYMMDD');
**** je v èíselníku pozic
begin
select count(*) into Tally from spozice where spozice.r_divID=4 and spozice.pozice=lcPozice ;
if Tally != 1 then
return -2;
end if;
**** èíslo pozice
select spoziceID into lnSpoziceID from spozice where spozice.r_divID=4 and spozice.pozice=lcPozice;
**** je v sdata ?
select count(*) into Tally from sdata where spoziceID=lnSpoziceID and datum=ldDatum ;"
if Tally=1 then
something ...
else
insert into sdata (sdataID,spoziceID,datum,hodnota1,hodnota2,NidZnak) values (sdataSEQ.NextVal,lnSpoziceID,ldDatum,lnHodnota1,lnHodnota2,USER);
something ...
end if;
end;
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement