Re: [SQL] Sub-query as function argument

2005-12-20 Thread Tom Lane
Michael Burke <[EMAIL PROTECTED]> writes: > Is it possible to execute a SELECT query as an argument to a function? > SELECT my_func('Sample', NULL, SELECT MIN(year) FROM audio); You need parentheses around the sub-SELECT. SELECT my_func('Sample', NULL, (SELECT MIN(year) FROM audio)); This is

Re: [SQL] Sub-query as function argument

2005-12-20 Thread Michael Burke
On December 20, 2005 10:52 am, Jaime Casanova wrote: > have you tried? Yes: => SELECT my_func('Sample', NULL, SELECT MIN(year) FROM audio); ERROR: syntax error at or near "SELECT" at character 32 PostgreSQL 7.4.9, myfunc is pl/pgsql. Just found a working method, though: => SELECT my_func('Sam

Re: [SQL] Sub-query as function argument

2005-12-20 Thread Jaime Casanova
On 12/20/05, Michael Burke <[EMAIL PROTECTED]> wrote: > Is it possible to execute a SELECT query as an argument to a function? > have you tried? -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) ---(end of broadcast)--- TIP 2: Don't 'kill -9

[SQL] Sub-query as function argument

2005-12-20 Thread Michael Burke
Is it possible to execute a SELECT query as an argument to a function? Example: SELECT my_func('Sample', NULL, SELECT MIN(year) FROM audio); In my particular case, my_func inserts columns into another table; I wish to use values from another table as the arguments. The interior SELECT will re