You're welcome.
>
>ok i understood.
>A big thank for help.
>
>
>Good afternoon
>
>bernhart
>
>>You have to use LEFT JOIN in order to upadte all records in the v_AgendaPhar. With INNER JOIN the records in v_AgendaPhar that don't have matching records in derived table pd will not be updated.
>>
>> UPDATE v_AgendaPhar ;
>> SET nstkjour = NVL( pd.nStkjourCor , 0 ) +1 ;
>> FROM v_AgendaPhar;
>> LEFT JOIN(;
>> SELECT apd.nstkjour AS nStkjourCor , apd.itraiterId ;
>> FROM AgendaPhar apd ;
>> WHERE apd.iagendadateid < vp_id ) pd ;
>> ON v_AgendaPhar.itraiterId = pd.itraiterId
>>
>>
>>
>>>
>>>I have many problems to know the stock of previous days.
>>>I want for the day ( iagendadateid = 2 ) the stock of ( iagendadateid = 1 ) + 1
>>>
>><snip>
--sb--