Re: Stored Functions
От | Barry Lind |
---|---|
Тема | Re: Stored Functions |
Дата | |
Msg-id | 3F465300.9080808@xythos.com обсуждение исходный текст |
Ответ на | Stored Functions ("Yolanda Phillips" <yphillips@dlkconsulting.co.za>) |
Список | 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 >
В списке pgsql-jdbc по дате отправления: