PL/PGSQL q? - Mailing list pgsql-hackers

From Vitaliy N. Kravchenko
Subject PL/PGSQL q?
Date
Msg-id ahueqa$676$1@igloo.uran.net.ua
Whole thread Raw
List pgsql-hackers
1234567890
Hi!
I write function on plpgsql and have some troubles:

I have table "owe" : uid int4, date int4, cost float4;
I want to select into "owe_old" : DECLARE owe_old float4;

cur_date := date_part(''year'', now()) || ''-'' || date_part(''month'', now()) || ''-01'';we have cur_date =
'2002-05-01'for example..
 

And I want to :SELECT INTO owe_old sum(cost) FROM owe WHERE date > int4(ABSTIME ''''cur_date''''');

And I have error:
NOTICE:  line 24 at select into variables
ERROR:  parser: parse error at or near "$1"

How I can substitute "cur_date" into SQL statement..?
Or how I can get sum(cost) in different way..?

Thank you!


-- 
--
Best regards, KVN.PHP4You   (<http://php4you.kiev.ua/>)PEAR [ru] (<http://pear.php.net/manual/ru/>) mailto:kvn@php.net


pgsql-hackers by date:

Previous
From: Matthew Tedder
Date:
Subject: Why is MySQL more chosen over PostgreSQL?
Next
From: cbbrowne@cbbrowne.com
Date:
Subject: Re: Why is MySQL more chosen over PostgreSQL?