Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9055419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:56:59+00:00 2026-06-16T13:56:59+00:00

How to call an Oracle stored procedure which takes a string and a date

  • 0

How to call an Oracle stored procedure which takes a string and a date as input and returns a refcursor as output using Clojure?

variable rc refcursor;
exec SOMEDB.PKG.GETPOSITIONS('ABC', to_date('2012-02-07','yyyy-mm-dd'), :rc)
print rc
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:57:01+00:00Added an answer on June 16, 2026 at 1:57 pm

    This is how I do it. I have included a few helper fn‘s that I use to convert strings to SQL dates.

    (ns foo
      (:require [clojure.java.jdbc :as jdbc]
                [clojure.string :as cs]))
    
    (def conn
      {:classname "oracle.jdbc.OracleDriver"
       :subprotocol "oracle:thin"
       :subname "@//host.name.here:port.here/db.here"
       :user "user"
       :password "pass"})
    
    (defonce ORACLE_CURSOR oracle.jdbc.driver.OracleTypes/CURSOR)
    
    (defn date-to-sql-date [date]
      (java.sql.Date. (.getTimeInMillis
                        (java.util.GregorianCalendar.
                          (+ (.getYear date) 1900) (.getMonth date) (.getDate date)))))
    
    (defn string-to-sql-date [date]
      ;; assumes American date formats
      (if-not (empty? date)
        (date-to-sql-date (java.util.Date. (cs/replace date #"-" "/")))))
    
    (jdbc/with-connection conn
      (with-open [stmt (.prepareCall (jdbc/connection) "{ call SOMEDB.PKG.GETPOSITIONS(?, ?, ?) }")]
        (doto stmt
          (.setString 1 "ABC")
          (.setDate 2 (string-to-sql-date "2012-02-07"))
          (.registerOutParameter 3 ORACLE_CURSOR)
          (.execute))
        (resultset-seq (. stmt getObject 3)))) ;; lazy-sequence
    

    resultset-seq

    NOTE: you may need to consume the entire sequence if you plan on returning it from a fn since the connection will close as soon as the fn returns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I do a call to an oracle stored procedure using JDBCTemplate which has an
I'm trying to call an Oracle Stored Procedure which returns XMLType data, but all
I am using QsqlQuery to call oracle stored procedure that uses input parameters and
I need to call a stored procedure using JPA and found this article: http://www.oracle.com/technology/pub/articles/vasiliev-jpql.html
How do I call an Oracle stored procedure with parameters? It has one input
I'm trying to call an Oracle stored procedure that accepts no input parameters. However,
I am using JDBC api to call a store procedure. Which returns a cursor.
I'm using Java and Ibatis to call a stored procedure on on oracle database.
How can I create an Oracle stored procedure which accepts a variable number of
I'm using Oracle DB. And I need to call stored procedure sequentially for 1000

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.