Received: from chac.qld.edu.au (linux.chac.qld.edu.au [203.37.221.131] (may be forged)) by hub.org (8.9.3/8.9.3) with ESMTP id CAA55792 for ; Fri, 14 Apr 2000 02:48:15 -0400 (EDT) (envelope-from jhunt@chac.qld.edu.au) Received: from julies (chac.inet [203.37.221.129]) by chac.qld.edu.au (8.9.3/8.9.3) with SMTP id QAA05748 for ; Fri, 14 Apr 2000 16:47:49 +1000 (EST) (envelope-from jhunt@chac.qld.edu.au) Message-ID: <002701bfa5dd$cfc346a0$9a14a8c0@julies> From: "Julie Hunt" To: Subject: Functions and tablenames Date: Fri, 14 Apr 2000 16:51:04 +1000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0024_01BFA631.9F4E9980" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3612.1700 X-MIMEOLE: Produced By Microsoft MimeOLE V4.72.3612.1700 X-Archive-Number: 200004/154 This is a multi-part message in MIME format. ------=_NextPart_000_0024_01BFA631.9F4E9980 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi I would like to create a function that passes a tablename as a variable, bu= t I do not know what 'datatype' a tablename is supposed to be. CREATE FUNCTION find_max_id(int4, tablename?) RETURNS int4 AS 'Select max($1) FROM $2' LANGUAGE 'sql'; When I put text as the datatype for the tablename the error was a problem n= ear $2. Could someone please help me. Thanks Julie Hunt ------=_NextPart_000_0024_01BFA631.9F4E9980 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi
I would like to create a function that = passes a=20 tablename as a variable, but I do not know what 'datatype' a tablename is= =20 supposed to be.
 
CREATE FUNCTION find_max_id(int4, table= name?)=20 RETURNS int4
AS 'Select max($1) FROM $2'
LANGUAGE 'sql';
 
When I put text as the datatype for the= =20 tablename the error was a problem near $2.
Could someone please help me.
Thanks
Julie Hunt
------=_NextPart_000_0024_01BFA631.9F4E9980--