Skip to content

Instantly share code, notes, and snippets.

@McPolemic
Last active December 12, 2015 01:48
Show Gist options
  • Save McPolemic/4693282 to your computer and use it in GitHub Desktop.
Save McPolemic/4693282 to your computer and use it in GitHub Desktop.
Oracle Singleton working in Ruby
[1] pry(main)> require './detpd270'
Warning: NLS_LANG is not set. fallback to US7ASCII.
=> true
[2] pry(main)> c = Connection.instance.conn
=> #<OCI8:LUKENAX>
[3] pry(main)> c.exec('select * from dual') { |results| puts results }
X
=> 1
[4] pry(main)> c.exec("select sysdate, to_char(sysdate, 'YYYYMMDD') from dual") { |results| puts results }
2013-02-01 12:50:06 -0500
20130201
=> 1
[5] pry(main)> c.exec("select sysdate, to_char(sysdate, 'YYYYMMDD') from dual") { |results| puts results.join ',' }
2013-02-01 12:50:25 -0500,20130201
=> 1
[6] pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment