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;
Previous
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