Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns db-test.core
- (:require [clojure.java.jdbc :as j])
- (use [korma.db])
- (use [korma.core])
- (:gen-class))
- (defn setup-connection []
- (def oracle-db {:classname "oracle.jdbc.odbc.OracleDriver"
- :subprotocol "oracle"
- :subname "thin:@//remotehost:1521/derpina1"
- :user "user"
- :password "pass" })
- (j/get-connection oracle-db)
- (default-connection oracle-db)
- (defentity PGDV_REPAIR))
- (def records (select PGDV_REPAIR (fields :PROD_ID :RETAIL :GOTO_RETAIL) (where {:REPAIR_ID [= 2 5]})))
- (defn alter-goto-repair
- []
- (doseq [{retail :RETAIL
- prod-id :PROD_ID
- :as row} records]
- (update PGDV_REPAIR (set-fields {:GOTO_RETAIL (+ (rand-int 100)
- retail)})
- (where {:REPAIR_ID [= 2 5]})
- (where {:PROD_ID prod-id}))))
- (defn -main
- "This function is where all the functions in this namespace come together"
- [& args]
- (setup-connection)
- (alter-goto-repair))
Advertisement
Add Comment
Please, Sign In to add comment