Re: Error when creating function in psotgresql 8.1
От
Sean Davis
Тема
Re: Error when creating function in psotgresql 8.1
Дата
Msg-id
C109FDD0.F9D6%sdavis2@mail.nih.gov
Ответ на
Re: Error when creating function in psotgresql 8.1 (ben sewell)
Список
Дерево обсуждения
Error when creating function in psotgresql 8.1 "ben sewell" <mosherben@gmail.com>
Re: Error when creating function in psotgresql 8.1 Sean Davis <sdavis2@mail.nih.gov>
Re: Error when creating function in psotgresql 8.1 "ben sewell" <mosherben@gmail.com>
Re: Error when creating function in psotgresql 8.1 Sean Davis <sdavis2@mail.nih.gov>
Re: Error when creating function in psotgresql 8.1 "ben sewell" <mosherben@gmail.com>
Re: Error when creating function in psotgresql 8.1 Sean Davis <sdavis2@mail.nih.gov>
Re: Error when creating function in psotgresql 8.1 "ben sewell" <mosherben@gmail.com>
Re: Error when creating function in psotgresql 8.1 Sean Davis <sdavis2@mail.nih.gov>
Re: Error when creating function in psotgresql 8.1 Richard Broersma Jr <rabroersma@yahoo.com>
Re: Error when creating function in psotgresql 8.1 "ben sewell" <mosherben@gmail.com>
Re: Error when creating function in psotgresql 8.1 Sean Davis <sdavis2@mail.nih.gov>
On 8/17/06 10:48 AM, "ben sewell" wrote: > Hi Sean, > that's fine I'll google it later the time when I need it. > > Sorry but I got another question about my procedure, I have my parameters > coming from the access forms which can be left empty (aka null). > > I'll need to create handling for when the parameters are null so this would > be using if statements. Once I've handled the input parameters the select > into queries will be run. Here's the pseudocode code for it so I was > wondering if you could tell me the equilivent for it in postgres. > > if adviser_id=null then > all records are returned irrespective if the adviser_id > else > find records which the adviser_id matches > endif; You may want to do something along the lines of: http://www.postgresql.org/docs/8.1/interactive/plpgsql-statements.html#PLPGS QL-STATEMENTS-EXECUTING-DYN Building the query a piece at a time and then executing. Alternatively, you can also create multiple functions with different prototypes (different parameter types) so that you could have a function like: My_func(int,int) .... And My_func(int) The two functions, although they have the same name, are different and can do different things. Sean
В списке pgsql-novice по дате отправления
От: Richard Broersma Jr
Дата: