Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Executing an Oracle Stored Procedure via ADO in VFP
Message
From
17/01/2001 14:39:05
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00464772
Message ID:
00464847
Views:
93
Andy,

Thanks for the code. I will give it a try. One question, I notice you are using a DSN instead of calling the MS Oracle OLE-DB provider directly. Any reason? This is my first time working with Oracle and VFP so I assumed calling directly would be faster.

Steve


>Here is one I prepared earlier <g>
>It call an Oracle sp that returns a Ref cursor (its a generalised version of one that I know works - it took me a _long_ time to sort this out!)
>The first block of code works with ADO, but there known bugs in RSToCursor()
>The second part (after the two rows of asterisks) works _without_ ADO and caused me even more grief to get working but IMHO is a much better solution:
>
>*****************
>*!*   CREATE OR REPLACE PACKAGE my_pkg AS
>*!*      TYPE curTyp IS REF CURSOR RETURN myvu%ROWTYPE;
>*!*      PROCEDURE open_my_cur (my_cur IN OUT curTyp,
>*!*                             choice IN VARCHAR2);
>*!*   END my_pkg;
>*!*   /
>*!*   CREATE OR REPLACE PACKAGE BODY my_pkg AS
>*!*     PROCEDURE open_my_cur (my_cur IN OUT curTyp,
>*!*                              choice IN VARCHAR2) IS
>*!*       BEGIN
>*!*       OPEN my_cur FOR  SELECT * from myvu
>*!*         where the_key = choice ;
>*!*     END open_my_cur;
>*!*   END my_pkg;
>*!*   /
>close all
>clear all
>release all
>clear
>oVFPCOM = CreateObject('vfpcom.comutil')
>con = createobject("ADODB.Connection")
>Rst = createobject("ADODB.RecordSet")
>con.Open("DSN=OraHTR;User Id=htr;PASSWORD=wingsof;UID=htr;SERVER=htr")
>strSP = "htr.htr_pkg_dev.open_trjn_cur(?, '00000001')"
>rst.open(strSP, con, 0, 1, 4)
>?rst.fields.count
>nError = oVFPCOM.RSToCursor(rst, 'myadocur')
>if nError >= 0
>   select myadocur
>   browse
>else
>?nError
>=aerror(ae)
>?'Error Text'
>disp memo like ae
>?'********************'
>rst.close
>con.close
>close all
>clear all
>release all
>return
>*****************
>*****************
>
>
>local nHndl, nSQLResult, noVal, cJobNo, ae
>nHndl = sqlconnect("OraDSN")
>if nHndl <+ 0
>   =aerror(ae)
>   disp memo like ae
>   sqldisconnect(0)
>   return
>endif
>
>noVal = ''
>nSQLResult = SQLExec(nHndl, "{call usr.my_pkg.open_my_cur (?noVal, '00000001')}","MyCursor")
>scatter NAME oSPora
>DEBUG
>use in MyCursor
>* ...
>
>* AndyD 8-)#
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform