annachau wrote:
> How can I use datetrunc in plpgsql function with quote 'day'?
>
> e.g.
> str_QuerySql = ''SELECT 1 FROM ot_Source WHERE source_code = ''
> || quote_literal(str_Source ) ||
> '' and status = ''
> || quote_literal(str_ACT) ||
> '' and (current_date - date_trunc('day', effective_date) ) >= 0 '' ||;
You're quoting something inside a quoted string (str_QuerySql) inside
another quoted string (the PL/pgSQL function). You need to escape twice.
''''
Scott