Skip site navigation (1) Skip section navigation (2)

Clarified Question

From: stef(at)chronozon(dot)dyndns(dot)org (Stef telford)
To: pgsql-sql(at)postgresql(dot)org
Subject: Clarified Question
Date: 2000-05-24 01:36:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
	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))
			result=select max(history_id)+1 from $1
				where client_id = $2;
		 	return result;
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 ;)


pgsql-sql by date

Next:From: Tubagus NizomiDate: 2000-05-24 02:55:51
Subject: Decimal ??
Previous:From: Joseph ShraibmanDate: 2000-05-23 23:46:57
Subject: Re: two fields in subselect

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group