Re: sql function: using set as argument - Mailing list pgsql-sql

From Thomas F. O'Connell
Subject Re: sql function: using set as argument
Date
Msg-id BC5D7F44-C952-4FC5-AB6E-8A41B4EA8CC4@sitening.com
Whole thread Raw
In response to sql function: using set as argument  ("Akshay Mathur" <akshay.mathur@airtightnetworks.net>)
Responses Re: sql function: using set as argument  ("Akshay Mathur" <akshay.mathur@airtightnetworks.net>)
List pgsql-sql
Is there a reason not to build it in as a sub-query?

E.g., if you have a function get_count( int ):

SELECT count(b_column)
FROM some_table
WHERE some_field_1 in (
    SELECT a_column
    FROM a_table
    WHERE some_condition
)
AND some_field_2 = $2;

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC

Strategic Open Source: Open Your i™

110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-469-5150
615-469-5151 (fax)

On Aug 10, 2005, at 9:30 AM, Akshay Mathur wrote:

Hi,

 

I have a function that returns a set.

Looks like:

            Select a_column from a_table where some_condition;

 

I want to use output of this function as an argument of another function

            Second looks like:

                        Get_count(result_set_of_function_1, int)

                                    Select count(b_column) from some_table where some_field_1 in ($1) and some_field_2 = $2;

 

Please suggest how can I do that?

 

Regards,

 

akshay

 

 

---------------------------------------

Akshay Mathur
SMTS, Product Verification

AirTight Networks, Inc. (www.airtightnetworks.net)

O: +91 20 2588 1555 ext 205
F: +91 20 2588 1445

 


pgsql-sql by date:

Previous
From: "Lane Van Ingen"
Date:
Subject: Re: catch an 'update where false' ?
Next
From: Sebastian Siewior
Date:
Subject: Problem with a Pettern Matching Check