Skip site navigation (1) Skip section navigation (2)

stored procedure calling problem: cursor "c_get_resources" does not exist

From: Imre Fazekas <Fazekas(at)ygomi(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: stored procedure calling problem: cursor "c_get_resources" does not exist
Date: 2010-02-10 14:26:19
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Dear All,

Let me share the following stored procedure:
CREATE OR REPLACE FUNCTION pdp.get_endpoints() RETURNS refcursor AS $$
    c_get_resources CURSOR (ep_id text) IS
        SELECT endpoint_resource.resource, endpoint_resource.sequence_index,, endpoint.protocol, endpoint.purpose from pdp.endpoint, pdp.endpoint_resource where = ep_id AND endpoint_resource.endpoint_id = ORDER BY endpoint_resource.sequence_index;


    open c_get_resources( 'nform' );

    RETURN c_get_resources;
END; $$ LANGUAGE 'plpgsql';
ALTER FUNCTION pdp.get_endpoints(text, text, text) OWNER TO eva;

The pgadmin accept it, i can call it using this:
SELECT pdp.get_endpoints() As Answer;
Works well.

By trying to call it using jdbc:
CallableStatement cs = db.prepareCall( "{ ? = call pdp.get_endpoints(?, ?, ?) }" );
cs.registerOutParameter(1, Types.OTHER);
 ResultSet rs = (ResultSet)cs.getObject(1);

I receive this:
 ERROR: cursor "c_get_resources" does not exist

Does anyone an idea how can i make it work? I would really appreciate it.

Thanks in advance!




pgsql-jdbc by date

Next:From: Mark KirkwoodDate: 2010-02-10 20:46:33
Subject: Re: stored procedure calling problem: cursor "c_get_resources" does not exist
Previous:From: AniDate: 2010-02-09 06:59:56
Subject: problem while connecting to schema

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group