|
Re: Oracle / Vb Consultant Needed in Youngstown [message #368904 is a reply to message #368903] |
Tue, 25 January 2000 16:02 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Paul Goodfellow
Messages: 3 Registered: January 2000
|
Junior Member |
|
|
Tom,
Please look at the example below. I hope that it helps.
If your problem is more complex or you have other questions please just let me know.
Regards,
Paul Goodfellow
Oracle function :-
CREATE OR REPLACE FUNCTION testfunc RETURN VARCHAR2 IS
uname VARCHAR2(30);
BEGIN
SELECT user INTO uname FROM DUAL;
RETURN uname;
END;
VB Code Calling Oracle Function using OO4O :-
Dim objOraSess As OraSession
Dim objOraDB As OraDatabase
Dim objOraSQLStmt As OraSqlStmt
Set objOraSess = CreateObject("OracleInProcServer.XOraSession")
Set objOraDB = objOraSess.OpenDatabase("MyDB.World", "user1/password", ORADB_DBDEFAULT)
objOraDB.Parameters.Add "UNAME", "", ORAPARM_OUTPUT
objOraDB.Parameters("UNAME").ServerType = ORATYPE_VARCHAR2
Set objOraSQLStmt = objOraDB.CreateSql("BEGIN :UNAME := TESTFUNC; END;", ORASQL_FAILEXEC)
MsgBox "Currently logged in user is " & objOraDB.Parameters("UNAME").Value
|
|
|