From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Néstor Boscán <nestorjb(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to callproc a PL/pgSQL function a cursor OUT parameter and two OUT parameters |
Date: | 2014-10-04 16:51:28 |
Message-ID: | 54302590.4040405@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 10/04/2014 09:16 AM, Néstor Boscán wrote:
> Hi
>
> I have a PL/pgSQL that looks like this:
>
> create or replace function my_function (p_cursor out refcursor, p_code
> out varchar, p_message out varchar) as $$
> begin
> open p_cursor for
> select * from table;
> p_code := 'AJ001';
>
> return;
> end; $$ language plpgsql;
>
> I've tried to invoke this function using:
>
> cursor.callproc('schema.my_function', [ 'mycursor', code, message ])
>
> But I get:
>
> HINT: Ninguna funci├│n coincide en el nombre y tipos de argumentos.
> Puede ser necesario agregar conversión explícita de tipos.
>
> In english is something like No function matches the name and types of
> arguments.
>
> Any ideas?
http://www.postgresql.org/docs/9.3/interactive/xfunc-sql.html#XFUNC-OUTPUT-PARAMETERS
"Notice that output parameters are not included in the calling argument
list when invoking such a function from SQL. This is because PostgreSQL
considers only the input parameters to define the function's calling
signature. That means also that only the input parameters matter when
referencing the function for purposes such as dropping it. We could drop
the above function with either of.."
So drop the OUT variables from your function call.
>
> Regards,
>
> Néstor
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2014-10-04 19:15:23 | Re: How to callproc a PL/pgSQL function a cursor OUT parameter and two OUT parameters |
Previous Message | Néstor Boscán | 2014-10-04 16:16:32 | How to callproc a PL/pgSQL function a cursor OUT parameter and two OUT parameters |