-- Collection of code snippets by Arne Vajhøj 
-- created to try various things (2003-now) 
CREATE OR REPLACE PACKAGE refcurpkg IS
  TYPE refcur_t IS ref cursor;
END refcurpkg;
/

CREATE OR REPLACE FUNCTION selectT1 RETURN refcurpkg.refcur_t IS
LANGUAGE JAVA NAME 'test.TestSP.selectT1() return java.sql.ResultSet';
/

CREATE OR REPLACE procedure insertT1(f1 number, f2 varchar2) IS
LANGUAGE JAVA NAME 'test.TestSP.insertT1(int, java.lang.String)';
/

CREATE OR REPLACE FUNCTION xparse(s VARCHAR2) RETURN NUMBER IS
LANGUAGE JAVA NAME 'test.XParse.xparse(java.lang.String) return java.math.BigDecimal';
/

SET SERVEROUTPUT ON
CALL dbms_java.set_output(2000);

EXECUTE insertT1(5,'zzzzz')
/

VARIABLE x refcursor
EXECUTE :x := selectT1;
PRINT x
/

SELECT xparse('170000000000000000000.0000000007') FROM dual
/

SELECT xparse('8') FROM dual
/

SELECT xparse('1299999999999999999999.8') FROM dual
/

DROP FUNCTION selectT1
/

DROP PROCEDURE insertT1
/

DROP FUNCTION xparse
/

DROP PACKAGE refcurpkg
/
