Jeff Eckermann escribió:
>
> Reminder to self: cast to text _before_
> concatenating(!)
> I won't retype the code, but I hope you get the
> idea...
Yes, I have tried this:
Create Function calc_stocks(text) Returns text AS '
Declare codart ALIAS For $1; all_stocks record; stock text;
Begin
Select sum(stocks.stkreal) as stock1, sum(stocks.stkpteser) as stock2 into all_stocksFrom stocks, prendasWhere
prendas.codprenda= stocks.codprenda and prendas.codarticulo = codart;
stock := (all_stocks.stock1::text || all_stocks.stock2::text); Return stock;
End;
' language 'plpgsql';
But now I have got neither error nor
result.
gesyweb=# select calc_stocks('020220064');calc_stocks
-------------
(1
row)
--
Gabriel D.