Concatenating a null value makes the string null. try:
SELECT 'foo'||NULL||'bar';
Just add a condition to check rivi.suoritus for null before making an
assignment.
Mauri Sahlberg wrote:
>returns nothing - bush becomes null and everything fails. I do not
>undestand why bush becomes null when the query returns nothing.
>
>
> bush:=''select * from PaivanLeimat('' ||
> quote_literal(aYritys) ||
> ''::varchar,'' ||
> quote_literal(nyt) ||
> ''::date,''||
> quote_literal(aKtunnus) ||
> ''::varchar,'' ||
> latest
> ||'')'';
>
>
<snip>
> latest:=rivi.suoritus;
>
>