oracle stored procs

Discussion in 'Ruby' started by AndrewMcDonagh, Jul 26, 2006.

  1. Hi,

    Has anyone managed to get calls to oracle stored procs to work yet?

    Cheers

    Andrew
     
    AndrewMcDonagh, Jul 26, 2006
    #1
    1. Advertising

  2. AndrewMcDonagh wrote:
    > Hi,
    >=20
    > Has anyone managed to get calls to oracle stored procs to work yet?
    >=20
    > Cheers
    >=20
    > Andrew
    >=20


    Sure. Using DBI with OCI8:

    dbh =3D DBI.connect(dsn, user, pass)
    sth =3D dbh.prepare("begin foo.some_proc; end;")
    sth.execute

    I don't think Kubo supports in/out parameters yet, though it has been =
    discussed.

    Regards,

    Dan


    This communication is the property of Qwest and may contain confidential =
    or
    privileged information. Unauthorized use of this communication is =
    strictly=20
    prohibited and may be unlawful. If you have received this communication =

    in error, please immediately notify the sender by reply e-mail and =
    destroy=20
    all copies of the communication and any attachments.
     
    Daniel Berger, Jul 26, 2006
    #2
    1. Advertising

  3. AndrewMcDonagh

    Jason Sweat Guest

    On 7/26/06, AndrewMcDonagh <> wrote:
    > Hi,
    >
    > Has anyone managed to get calls to oracle stored procs to work yet?


    Works fine for me out of the box. Here are some extentions I made to
    the OCI8 class to make it easier for me to deal with a ref cursor
    returned from a package function:

    class OCI8
    class Cursor
    def get_array
    ret = []
    while row = self.fetch_hash
    ret << row
    end
    ret
    end
    def bind(binds)
    binds.each_pair do |k,v|
    if v.respond_to? :indices
    self.bind_param(k, v[0], v[1], v[2])
    else
    self.bind_param(k, v)
    end
    end if binds
    end
    end

    def get_ref(plsql, binds=false, &block)
    cur = self.parse('begin :rs := '+plsql+'; end;')
    cur.bind_param(':rs', OCI8::Cursor)
    cur.bind(binds)
    cur.exec
    if block_given?
    arr = cur[':rs'].get_array.collect &block
    else
    cur[':rs'].get_array
    end
    end
    end

    --
    Regards,
    Jason
    http://blog.casey-sweat.us/
     
    Jason Sweat, Jul 26, 2006
    #3
  4. Daniel Berger wrote:
    > AndrewMcDonagh wrote:
    >> Hi,
    >>
    >> Has anyone managed to get calls to oracle stored procs to work yet?
    >>
    >> Cheers
    >>
    >> Andrew
    >>

    >
    > Sure. Using DBI with OCI8:
    >
    > dbh = DBI.connect(dsn, user, pass)
    > sth = dbh.prepare("begin foo.some_proc; end;")
    > sth.execute
    >
    > I don't think Kubo supports in/out parameters yet, though it has been
    > discussed.
    >
    > Regards,
    >
    > Dan
    >
    >
    > This communication is the property of Qwest and may contain confidential or
    > privileged information. Unauthorized use of this communication is
    > strictly prohibited and may be unlawful. If you have received this
    > communication in error, please immediately notify the sender by reply
    > e-mail and destroy all copies of the communication and any attachments.
    >

    sweet cheers!

    last time I looked it didn't work or work well - hence the question.

    Andrew
     
    AndrewMcDonagh, Jul 26, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul R
    Replies:
    1
    Views:
    374
    Eric Veltman
    Dec 2, 2003
  2. =?Utf-8?B?QUtKVFI=?=

    Multiple stored procs for dataadapter

    =?Utf-8?B?QUtKVFI=?=, Dec 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    385
    Karl Seguin
    Dec 21, 2004
  3. Roy
    Replies:
    4
    Views:
    476
    souri challa
    Jun 2, 2005
  4. JV

    Calling Oracle Stored Procs

    JV, Nov 21, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    883
    =?Utf-8?B?VmVua2F0X0tM?=
    Nov 23, 2005
  5. matt
    Replies:
    1
    Views:
    270
    George Ogata
    Aug 6, 2004
Loading...

Share This Page