Обсуждение: a plpgsql programming question

Поиск
Список
Период
Сортировка

a plpgsql programming question

От
Jefim Matskin
Дата:
I have the following problem;
The client of the DB issues a lot of the SQL commands over a network , the
statements are of the simple form - select an integer from some table(s)
using some criteria.
I want to create a function that will accept the string containing all the
statements to be executed, a string containing the length of the statements
to be executed and will return the string containing all the integer values
retrieved.

And the questions are:
1. How to execute a sql statement that is contained in the text variable in
the function
2. How to get the result of that statement into a variable.

Thanks.
 Jefim Matskin
 ---------------------------------------------
 Senior SW engeneer
 Sphera Corporation
 Tel: +972.3.613.2424 Ext:104
 mailto:mjefim@sphera.com
 http://www.sphera.com/


Re: a plpgsql programming question

От
"mike"
Дата:
Well,

If you use the PHP,
$sql_statement = " SELECT ... ";
$array_result = pgexec(connecttion, $sql_statement);
$i = pg_numrows($array_result)
for ($j=0; $j<$i;$j++)
    echo $array_result[i];

Hope this helps ... :)

"Jefim Matskin" <mjefim@sphera.com> wrote in message
news:11EB6F74CACFD21199370050DAB8AA12A35F46@EXCHSPHERA...
>
> I have the following problem;
> The client of the DB issues a lot of the SQL commands over a network , the
> statements are of the simple form - select an integer from some table(s)
> using some criteria.
> I want to create a function that will accept the string containing all the
> statements to be executed, a string containing the length of the
statements
> to be executed and will return the string containing all the integer
values
> retrieved.
>
> And the questions are:
> 1. How to execute a sql statement that is contained in the text variable
in
> the function
> 2. How to get the result of that statement into a variable.
>
> Thanks.
>  Jefim Matskin
>  ---------------------------------------------
>  Senior SW engeneer
>  Sphera Corporation
>  Tel: +972.3.613.2424 Ext:104
>  mailto:mjefim@sphera.com
>  http://www.sphera.com/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl