pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: stef@chronozon.dyndns.org
To: pgsql-sql@postgresql.org
Subject: Clarified Question
Date: Tue, 23 May 2000 20:36:43 -0500 (CDT)
Message-ID: <20000524013643.C37C31F57C@chronozon.dyndns.org> (raw)

Hello,
	Earlier I sent in some ramblings trying to explain my problm.
I think I have it better summarised now.

How can I create a function that will take in two variables and return
an integer, when one of the variables is the tablename ?!

I have tried :
	
		create function tst_func(text, varchar(16))
		as 
		'BEGIN
			result=select max(history_id)+1 from $1
				where client_id = $2;
		 	return result;
		 END;'
		
Please excuse the roughness of the code, I am not at my work machine
where I have postgres all setup. 

(oh. and jst a little query, is the 'max' actaully a stored procedure
 or an SQL keyword ?! I cant seem to find it in any of the documentation
 probbly cause I overlooked it ;)

Thanks,
Steffs



view thread (2+ messages)  latest in thread

Message-ID: <20000524013643.C37C31F57C@chronozon.dyndns.org>
Permalink:  ../20000524013643.C37C31F57C@chronozon.dyndns.org/
Also on:    postgresql.org/message-id/20000524013643.C37C31F57C@chronozon.dyndns.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: stef@chronozon.dyndns.org
  Subject: Re: Clarified Question
  In-Reply-To: <20000524013643.C37C31F57C@chronozon.dyndns.org>
  References: <20000524013643.C37C31F57C@chronozon.dyndns.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox