Re: [GENERAL] plpgsql dynamic queries and optional arguments

2006-08-16 Thread Michael Fuhr
On Wed, Aug 16, 2006 at 02:36:44PM -0500, Curtis Scheer wrote: > Thanks for the reply I guess what I am actually looking for is an example of > a dynamic SQL select statement similar to how a static sql select can select > into a variable. In 8.1 you can select a single row or columns of a single

Re: [GENERAL] plpgsql dynamic queries and optional arguments

2006-08-16 Thread Curtis Scheer
Allan, Thanks for the reply I guess what I am actually looking for is an example of a dynamic SQL select statement similar to how a static sql select can select into a variable. Thanks, Curtis Curtis, Here is an example function that uses dynamic sql. I use it under 7.4.5 Hope this helps. A

Re: [GENERAL] plpgsql dynamic queries and optional arguments

2006-08-15 Thread Harvey, Allan AC
x27;'' || pt.savefor::varchar || '' days'''')::timestamp;''; execute sql_str; count := count + 1; end loop; return count; end; ' LANGUAGE plpgsql; -Original Message----- From: [EMAIL PROTECTED] [mailt

[GENERAL] plpgsql dynamic queries and optional arguments

2006-08-15 Thread Curtis Scheer
I have a table that I would like to be able to retrieve information out of based on a combination of multiple columns and I would like to be able to do this through a plpgsql stored procedure. Right now I have multiple stored procedures that I am calling based on the values parameter values

Re: [GENERAL] plpgsql , dynamic queries

2003-08-28 Thread Heath Tanner
It would be easier to help you with the quoting issues if you provided an example of the entire query you need to execute and/or the code you're using to build the query. Quoting in a function can get pretty hairy sometimes. You might find this chart helpful, I certainly have: http://www.postg

[GENERAL] plpgsql , dynamic queries

2003-08-28 Thread Alex
Hi, I am having problems in forming a dynamic query that can be used in Execute statements. Problem: I have database fields that are either INT or VARCHAR. Both can have NULL. If I use variables that hold the db field's values ... how do I need to quote them to pass them to the query string. e