Skip to content

Instantly share code, notes, and snippets.

@frankvilhelmsen
Last active September 6, 2021 17:23
Show Gist options
  • Save frankvilhelmsen/5336873 to your computer and use it in GitHub Desktop.
Save frankvilhelmsen/5336873 to your computer and use it in GitHub Desktop.
call oracle stored procedure returning-java types from clojure
(ns package.classnamere)
(:import java.sql.Types)
(def db {:classname "oracle.jdbc.driver.OracleDriver"
:....
:password (System/getenv "password")})
(defn prepared-statement " on oracle stored procedure " []
(jdbc/with-connection db
(with-open [stmt (.prepareCall (jdbc/connection) "{ call PACKAGE.PROCEDURE(?, ?) }")]
(doto stmt
(.registerOutParameter 1 java.sql.Types/INTEGER)
(.registerOutParameter 2 java.sql.Types/VARCHAR)
(.execute))
(. stmt getObject 2))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment