I need to to change an ip addres in a plpgsql function from aaa.bbb.ccc.ddd to an sring containing "aaa bbb ccc ddd upload".
The following code does not work. It complaines about the replace line (or is it the assignment?):
ERROR: syntax error at or near "replace" at character 1
CONTEXT: PL/pgSQL function "getcustomerdownload" line 14 at SQL statement) :
CREATE OR REPLACE FUNCTION getcustomerdownload(text, timestamp, timestamp)
RETURNS int4 AS
select into my_ipaddress customertable.ipaddress
select customer.objectid, getcustomername(customer.objectid) as customername, customer.ipaddress from customer
where customertable.customername like ''$1%'';
my_ipaddress_as_text := host(my_ipaddress);
replace(my_ipaddress_as_text ,''.'','' '');
return cast( (sum(bytes)/(1024*1024)) as int8) from logs
rule_name = my_ipaddress_as_text | '' upload''
that_time between cast( abstime($2) as int4) and cast( abstime($3) as int4);
LANGUAGE 'plpgsql' VOLATILE;
Does anyone have any idea of how to do this?
tel: 024-3888063 / 06-51855277
pgsql-general by date
|Next:||From: Scott Ribe||Date: 2004-12-28 21:34:34|
|Subject: Re: OSX 10.3.7 broke Postgresql 8.0.0b5? |
|Previous:||From: Magnus Hagander||Date: 2004-12-28 21:22:57|
|Subject: Re: 8.0 Beta3 worked, RC1 didn't!|