В общем весь текст
create or replace function get_goods_ondate2(art in string,
mh in number,
dat in date) return number is
Res number(14, 3);
begin
Supermag.Remains.Calc(to_date(dat, 'dd.mm.yyyy'), false, 23, 1, false);
Select ost_dat
into Res
from (Select ttr.quantity as ost_dat,
ttr.article,
ttr.remdate,
ttr.storeloc
from supermag.ttremains ttr
where ttr.remdate = to_date(dat, 'dd.mm.yyyy')
and ttr.article = art
and ttr.storeloc = mh);
return(Res);
end get_goods_ondate2;