Stored Procedure Assistance

Поиск
Список
Период
Сортировка
От Bradley J. Bartram
Тема Stored Procedure Assistance
Дата
Msg-id 200307081255.00649.bbartram@dyrectmedia.com
обсуждение исходный текст
Ответы Re: Stored Procedure Assistance  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Re: Stored Procedure Assistance  (Michael Pohl <pgsql@newtopia.com>)
Re: Stored Procedure Assistance  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
I'm relatively new to stored procedures and I've run into a situation that is
above my current level of ability and I can't seem to find any examples of
how to go about it.

Here is the run down of what I need to do, if someone could either give me an
exmaple or even a nice repository of information on how to do this, I would
be quite grateful.

I'm looking at a series of queries, all simple selects, that are run to
produce a final result set.  Right now they are coded in php and there are
some techniques used to construct the queries that I'm trying to duplicate on
the backend.

The first query is simple:

SELECT a FROM table_a WHERE column_a = b

This will return a single row.  The next query takes that derived value and
does a simliar select that returns multiple rows.

SELECT c FROM table_b WHERE column_b = a

The next query has some logic in php that constructs it.  Basically if c > 0
than the results of query 2 are setup as ORs in the WHERE clause.

SELECT d FROM table_c WHERE column_c = c1 OR column_c = c2, etc.

The first two queries are not a problem, but how can I take the array of
results from query 2 and put them into query 3?

Thanks in advance.

brad
--
Bradley J. Bartram


В списке pgsql-general по дате отправления:

Предыдущее
От: "Maksim Likharev"
Дата:
Сообщение: Re: PG crash on simple query, story continues
Следующее
От: "Maksim Likharev"
Дата:
Сообщение: Re: PG crash on simple query, story continues