Oracle Procedure dont work with Ref Cursor OUT

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
amarildolacerda
Junior Boarder
Junior Boarder
Posts: 30
Joined: 12.08.2011, 12:42
Location: Brazil
Contact:

Oracle Procedure dont work with Ref Cursor OUT

Post by amarildolacerda »

I have some procedure into oracle packaege that work fine.
This days I receive from DBA one procedure that OUTPUT a Ref CURSOR.

Pkg_test.procedure( listParams IN , refCursor OUT );

http://asktom.oracle.com/pls/asktom/ASK ... 3078805685
http://www.oracle-base.com/articles/mis ... rdsets.php

Some one known how I can retrieve this Oracle - Ref Cursor ?
Last edited by amarildolacerda on 22.04.2012, 20:08, edited 1 time in total.
amarildolacerda
Junior Boarder
Junior Boarder
Posts: 30
Joined: 12.08.2011, 12:42
Location: Brazil
Contact:

Post by amarildolacerda »

I propose add stCursor at ZDbcIntfs.TZSQLType

TZSQLType = (stUnknown, stBoolean, stByte, stShort, stInteger, stLong, stFloat,
stDouble, stBigDecimal, stString, stUnicodeString, stBytes, stDate, stTime,
stTimestamp, stAsciiStream, stUnicodeStream, stBinaryStream,stCursor);


It will be possible to suport Oracle RefCursor with procedure OUTPUT or Result Functions
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

amarildolacerda,

i wish i could say YES, lets do it. But here i'm waiting for MDeams. He's oracle developer. In my mind we still need an upgrade here concernung stCurrency, stBCD, ..., stCursor.

Which type is the Cursor from? types.cursorType

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

As far as I understand there's not a real generic way you can develop to handle the data returned. You could do so when you're sure the procedure only returns one variable, which is the refcursor variable. This isn't really something you easily do with a 'one resultset at a time' architecture as zeoslib's.

I think I would write a wrapper 'Oracle Pipelined Table Function' for this procedure that takes the same input parameters as your procedure.
That way you can select from te wrapper function that in turn calls the procedure and then reads the refcursor content line by line. That way you have a select * from table(<wrapper function call>) that can be handled easily by TZQuery.

Mark
Image
amarildolacerda
Junior Boarder
Junior Boarder
Posts: 30
Joined: 12.08.2011, 12:42
Location: Brazil
Contact:

Post by amarildolacerda »

First of all, Its so complex for me.
I try to change some piece of code to see if its possible CAST/Convert ref cursor (POCIStmt) parameters to IZStatement and/or IZDataset like TNestedDataset;

Ill attach my code... (no complete yet) (ZDbcOracleStatement line 819)

....
case CurrentVar.TypeCode of
SQLT_RSET : DefVarManager.SetAsPointer( outParamValues, CurrentVar.Data );
....


About Table Functions, its sound good.
Nowadays, I have package to isolate Oracle Code and execute some before retrieve dataset
You do not have the required permissions to view the files attached to this post.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

amarildolacerda,
You're ambitous! Certainly more than I am.
If you get TNestedDatasets working, that would be extremely nice. But even a utility function to get a dbc resultset instance from a refcursor would be nice!
I'm hopefully waiting for the result of your experiments!

Mark
Image
Locked