Re: Stored Functions

From: Barry Lind <blind(at)xythos(dot)com>
To: yphillips(at)dlkconsulting(dot)co(dot)za
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Stored Functions
Date: 2003-08-22 17:29:36
Message-ID: 3F465300.9080808@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Yolanda,

This functionality is only in the current development driver, it was
added since the 7.3 version of the driver. The current development
driver should run fine against a 7.3 database however.

--Barry

Yolanda Phillips wrote:
> Good day,
>
> I urgently need help!!
>
> I've just upgraded to postgresql-7.3.4. Using pg73jdbc3.jar driver. This is
> because I really need to use stored functions.
>
> This is the plpgsql function:
>
> CREATE OR REPLACE FUNCTION LoadGlobals(INT) RETURNS refcursor AS '
> DECLARE
> v_global_id ALIAS FOR $1;
> ref refcursor;
> BEGIN
>
> OPEN ref FOR
> SELECT global_values_desc, section_title, menu_url, include_file_url
> FROM GLOBAL_VALUES
> WHERE global_values_id = v_global_id;
> --IF NOT FOUND THEN --If nothing was returned in the last query
> --RAISE EXCEPTION ''Invalid global id.'';
> --ELSE
> RETURN ref;
> --END IF;
>
> END;
> ' LANGUAGE 'plpgsql';
>
> The JDBC code:
>
> private static final String driver = "org.postgresql.Driver";
> private static final String user = "someuser";
> private static final String pass = "password";
> private static final String dbURL =
> "jdbc:postgresql://10.123.0.00/somedb";
>
> conn.setAutoCommit(false);
> CallableStatement proc = conn.prepareCall("{? = call LoadGlobals (?) }");
> proc.registerOutParameter(1, Types.OTHER);
> proc.setInt(2, sectionId);
> proc.execute();
> results = (ResultSet)proc.getObject(1);
> System.out.println("ResultSet: " + results);
>
> ...
>
> I get the following error:
> SQL Exception: No class found for refcursor
>
> Any suggestions?
>
>
>
> Sincerely,
>
>
> Yolanda Phillips
> Web Applications Developer
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Patrick Hatcher 2003-08-22 18:54:35 how to do a SET search_path?
Previous Message Barry Lind 2003-08-22 17:09:27 Re: Error messaages