Stored Functions

From: "Yolanda Phillips" <yphillips(at)dlkconsulting(dot)co(dot)za>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Stored Functions
Date: 2003-08-22 07:42:38
Message-ID: 000701c36880$f6ee2290$2300800a@dlkapp.dlkconsulting.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message srikanth nagaraju 2003-08-22 07:59:02 Re: Stored Functions
Previous Message Derek S 2003-08-22 03:14:02 Re: [BUGS] Bug #926: if old postgresql.jar in CLASSPATH,