Hi,

I have a stored procedure which returns a SETOF RECORD.
so basically a partial rowtype from a table.

to execute the query in PHP, i must write :
select * from myschema.sp_a_002('username') as result(Column1 varchar);

to get the result.

However, is there another to get the result without using 'as result(column1
varchar)' ?
something like a simple "select * from storedprocedure(param);", for example
:-)

thanks a lot,

--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5

Search Discussions

  • David Legault at Mar 13, 2007 at 5:57 pm

    On 3/13/07, Alain Roger wrote:
    Hi,

    I have a stored procedure which returns a SETOF RECORD.
    so basically a partial rowtype from a table.

    to execute the query in PHP, i must write :
    select * from myschema.sp_a_002('username') as result(Column1 varchar);

    to get the result.

    However, is there another to get the result without using 'as
    result(column1 varchar)' ?
    something like a simple "select * from storedprocedure(param);", for
    example :-)

    thanks a lot,

    --
    Alain
    ------------------------------------
    Windows XP SP2
    PostgreSQL 8.1.4
    Apache 2.0.58
    PHP 5


    That's what I do in PHP

    if it returns a set "SELECT * FROM myfunction(arg1,arg2,...)"

    Then I can just iterate over every record/line/row.

    I don't have any stored proc that actually returns a setof record in any of
    my functions though, but I would imagine that it doesn't make a difference
    in how you call it.

    Could you past the whole function?

    David
  • Roman Neuhauser at Mar 13, 2007 at 10:19 pm

    # raf.news@gmail.com / 2007-03-13 18:29:36 +0100:
    Hi,

    I have a stored procedure which returns a SETOF RECORD.
    so basically a partial rowtype from a table.

    to execute the query in PHP, i must write :
    select * from myschema.sp_a_002('username') as result(Column1 varchar);

    to get the result.

    However, is there another to get the result without using 'as result(column1
    varchar)' ?
    something like a simple "select * from storedprocedure(param);", for example
    :-)
    Yes, create a type, and have the function return SETOF your-type. You
    need to name the types *somewhere*.

    --
    How many Vietnam vets does it take to screw in a light bulb?
    You don't know, man. You don't KNOW.
    Cause you weren't THERE. http://bash.org/?255991

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-general @
categoriespostgresql
postedMar 13, '07 at 5:29p
activeMar 13, '07 at 10:19p
posts3
users3
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase