mercredi 22 avril 2015

When I call a function, it returns null if the argument is not set

When I call a function, if the argument is not set it doesn't work. This issue happens only for this DATE type argument. How come?!!!

set @date = '2015-01-01';

select stock_date(shop, description, 5, @date) from packaging where shop = 'xxx';

Result:

stock_date(shop, description, 5, @date)

3130.00

3093.00

2157.00

2463.00
...

Then if i put a date directly in the function, it doesn't work!

select stock_date(shop, description, 5, '2015-01-01') from packaging where shop = 'xxx';

stock_date(shop, description, 5, '2015-01-01')

NULL

NULL

...

This issue make me crazy. I need this function for calculate other things and because of this it gives me wrong results.

Aucun commentaire:

Enregistrer un commentaire