> From: John Edstrom <edstrom@Poopsie.hmsc.orst.edu>
> To: pgsql-sql@postgreSQL.org
> How about
> CREATE FUNCTION F(int,char) returns int4 as
> 'SELECT max(tr_date) FROM crtd1
> WHERE $1=tr_id
> AND $2=tr_unit
> AND (tr_type = \'A\' OR
> tr_type = \'I\');'
> language 'sql';
>
> SELECT distinct tr_id,F(tr_id) from crtd1;
Good idea but...Arrrgh!
This is what I get back:
ERROR: There is no operator '=' for types 'int4' and 'bpchar'
You will either have to retype this query using an explicit cast,
or you will have to define the operator using CREATE OPERATOR
(thanks- I will keep fiddling...)
Tom
---------- Sisters of Charity Medical Center ----------
Department of Psychiatry
----
Thomas Good <tomg@q8.nrnet.org>
Coordinator, North Richmond C.M.H.C. Information Systems
75 Vanderbilt Ave, Quarters 8 Phone: 718-354-5528
Staten Island, NY 10304 Fax: 718-354-5056