Note: The following processes are tested in Delphi7 Oracle9i. First, use Delphi to prepare a DLL program. Of course, use VB, VC other languages, I often use Delphi, so the following DLL uses Delphi program: //Project1.dpr Project Document library project1; uses sysutils, classes, unit1 in 'unit1.pas'; {$ r * .res} exports dlltest; beginend ./// Unit1.PAS interface function implementation file unit unit1; InterfaceFunction DLLTest (A, B: Double : Double; CDECL; // Interface Function ImplementationFunction DLLTEST (A, B: Double): Double; CDECL; // Interface Function Begin Result: = A * B; END; END.2, will compile the generated Project1.dll copy Under the $ ORACLE_HOME / BIN path, I have $ ORACLE_HOME = C: / Oracle / ORA92 So copying Project1.dll to the C: / Oracle / ORA92 / BIN / path. 3, add a library name to "Mylib" Create or Replace Library mylib as 'c: /oracle/ora92/bin/project1.dll'; 4, an Oracle database adds a Function name to "Mytest1" Create or Replace FUNCTION mytest1 (a DOUBLE PRECISION, b DOUBLE PRECISION) RETURN DOUBLE PRECISION AS LANGUAGE C NAME "dlltest" LIBRARY MYLIB PARAMETERS (a DOUBLE, b DOUBLE, RETURN DOUBLE); 5, test select mytest1 (3.51,8.2) from dual; - ----------- Returns 28.7826, to this simple example, in fact, this is the simplest example, actual application needs to be done according to demand, I do this example just to open the way, Actual application also needs to refer to Oracle Help Documents.
Source program and script download address:
http://www.cnoug.org/attachment.php?aid=20557
Yasheng 2005-03-11