The main intension of the
following code is to inspire you to learn the possibilities. There are
almost many ways to solve it ...
OO4O is available at Oracle-release 8.x or newer
(Also, since ActiveX had it`s time).
Ok, now will be released Oracle 10g. Maybe we will
upgrade. But it`ll support OO4O too, i hope ;-)
A helpfile ("Oracleo.hlp" at directory MShelp) is
also included.
IF you won`t find it ... follow this link.
System requirements are:
Operating System:
- Windows 98
- Windows NT
- Windows 2000
- Windows XP
local or remote installed/available Oracle-Database
(Oracle8, 8i, 9i or newer)
******************************************
&& has to be a valid value (see also at your INI-file tnsnames.ora)
lcOracDB='database1'
lcUser='Gerd'
lcPW='Baiertaler'
lcSQLCMD='SELECT * FROM user_tables'
OO4OS=CreateObject("OracleInProcServer.XOraSession")
OO4OS.CreateDatabasePool(1,40,200,lcOracDB,lcUser+"/"+lcPW,0)
OraDB = OO4OS.GetDatabaseFromPool(10)
OraDynS = OraDB.CreateDynaset(lcSQLCMD,0)
*** loaded and now hurry on objectoriented ***
nColumns = OraDynS.Fields && Fieldarray
lnanzF=nColumns.Count && how much fields
lnanzR=OraDynS.RecordCount && records?
******************************************
The SQL-statement has the fully command range such like INSERT, UPDATE,
DELETE etc.
But be careful at several situations ! Packages, like the stored procedures
(SP) on SQL-servers, are one example of this:
lnz_id=1412 && numeric VAR
&& Numeric variable will as <I>nput.
&& I remove it first. "Sure is sure" ;-)
oraDBC.Parameters.remove("I_ID")
oraDBC.Parameters.remove("O_RESULT")
&& the 3rd parameter = 1 for
&& Input , 2 = Output
&& the 4th submits the type (1=C,2=N,12=D, further
&& information is at OO4O-Helpfile)
oraDBC.Parameters.Add("I_ID",lnz_id,1, 2)
oraDBC.Parameters.Add("O_RESULT",-1,2, 2)
*** ready to rumble? ...
*** Gerd && Username to execute
*** B_VERBRAEUCHE && Package Name
*** ManuellUpdate && Function
oTest = oraDBC.CreateSql("begin Gerd.B_VERBRAEUCHE.ManuellUpdate(" + ;
":I_ID + ", :O_ERGEBNIS); end;", 0)
For description of packages i want to refer to many docu from oracle and
other printing presses. Have a closer look at some Usergroups. The german
group will be reached on "Deutsche Oracle Anwender Gruppe" (DOAG).
Now, greetings and have much fun ;-)
Gerd Straub, "Baiertaler"