Last active
December 16, 2015 02:29
-
-
Save frankvilhelmsen/5362434 to your computer and use it in GitHub Desktop.
call oracle stored procedure returning-cursor from clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns package.classname | |
(:require [clojure.xml :as xml] | |
[clojure.java.jdbc :as jdbc])) | |
(:import java.sql.Types) | |
(def db {:classname "oracle.jdbc.driver.OracleDriver" | |
: .... | |
:password (System/getenv "password")}) | |
(jdbc/with-connection db | |
(with-open [stmt (.prepareCall (jdbc/connection) "{ call PACKAGE.PROCEDURE(?, ?) }")] | |
(doto stmt | |
(.registerOutParameter 1 java.sql.Types/INTEGER) | |
(.registerOutParameter 2 oracle.jdbc.OracleTypes/CURSOR) | |
(.execute)) | |
(vec (resultset-seq (. stmt getObject 2))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment