Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Executing an Oracle Stored Procedure via ADO in VFP
Message
 
 
À
17/01/2001 12:35:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00464772
Message ID:
00464785
Vues:
52
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-)#
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform