DROP TABLE person;
CREATE TABLE person
(ssn NUMBER(
fname VARCHAR
lname VARCHAR
INSERT INTO person VALUES(
INSERT INTO person VALUES(
INSERT INTO person VALUES(
COMMIT;
/
CREATE OR REPLACE PACKAGE packperson
AS
TYPE tssn is TABLE of NUMBER(
INDEX BY BINARY_INTEGER;
TYPE tfname is TABLE of VARCHAR
INDEX BY BINARY_INTEGER;
TYPE tlname is TABLE of VARCHAR
INDEX BY BINARY_INTEGER;
PROCEDURE allperson
(ssn OUT tssn
fname OUT tfname
lname OUT tlname);
PROCEDURE oneperson
(onessn IN NUMBER
ssn OUT tssn
fname OUT tfname
lname OUT tlname);
END packperson;
/
CREATE OR REPLACE PACKAGE BODY packperson
AS
PROCEDURE allperson
(ssn OUT tssn
fname OUT tfname
lname OUT tlname)
IS
CURSOR person_cur IS
SELECT ssn
FROM person;
percount NUMBER DEFAULT
BEGIN
FOR singleperson IN person_cur
LOOP
ssn(percount) := singleperson
fname(percount) := singleperson
lname(percount) := singleperson
percount := percount +
END LOOP;
END;
PROCEDURE oneperson
(onessn IN NUMBER
ssn OUT tssn
fname OUT tfname
lname OUT tlname)
IS
CURSOR person_cur IS
SELECT ssn
FROM person
WHERE ssn = onessn;
percount NUMBER DEFAULT
BEGIN
FOR singleperson IN person_cur
LOOP
ssn(percount) := singleperson
fname(percount) := singleperson
lname(percount) := singleperson
percount := percount +
END LOOP;
END;
END;
/
Option Explicit
Dim Cn As ADODB
Dim CPw
Dim CPw
Dim Rs As ADODB
Dim Conn As String
Dim QSQL As String
Dim inputssn As Long
Private Sub cmdGetEveryone_Click()
Set Rs
Rs
While Not Rs
MsgBox
Rs
Wend
Rs
End Sub
Private Sub cmdGetOne_Click()
Set Rs
inputssn = InputBox(
CPw
Rs
MsgBox
Rs
End Sub
Private Sub Form_Load()
口令(PWD)和服務器名稱(SERVER)
Conn =
&
Oracle};SERVER=dseOracle;
Set Cn = New ADODB
With Cn
End With
QSQL =
{resultset
&
Set CPw
With CPw
Set
End With
QSQL =
{resultset
&
Set CPw
With CPw
Set
adParamInput)
End With
Set Rs = New ADODB
With Rs
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cn
Set Cn = Nothing
Set CPw
Set CPw
Set Rs = Nothing
End Sub
From:http://tw.wingwit.com/Article/program/Oracle/201311/16721.html