SAK }‘ŠŲ

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠŲEƒJƒtƒF ˆę—— SAK Streets ŒŸõ
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

VB oo4o + SQL ‰ž—p•Ō9 oo4o ƒXƒgƒAƒhƒtƒ@ƒ“ƒNƒVƒ‡ƒ“ - CreatePLSQLDynaset

oo4o ‚́AOracle RDBMS ‚Å‚ÝŽg—p‰Â”\‚Å‚·B

ĄƒXƒgƒAƒhƒpƒbƒP[ƒW

  EŽŸ‚Ė‚æ‚Ī‚ɃJ[ƒ\ƒ‹‚ð•Ô‚·ƒXƒgƒAƒhƒpƒbƒP[ƒW‚Š‚ ‚é‚Æ‚ĩ‚Ü‚·B
    ‚ą‚ę‚ð CreatePLSQLDynaset ‚ÅŽĀs‚ĩ‚āAƒŒƒR[ƒhƒZƒbƒg‚ðŽæ“ū‚ĩ‚Ü‚·B
    (OraDynasetAƒJ[ƒ\ƒ‹Žæ“ū)

create or replace package testp as
  cursor c1 is select * from ƒeƒXƒgm;
  type testmcu is ref cursor return c1%rowtype; 
  procedure GetTestm(key in varchar2, cu in out testmcu);
end;
/

create or replace package body testp is

  procedure GetTestm(key in varchar2, cu in out testmcu) is
  begin 
    open cu for select * from ƒeƒXƒgm where ƒL[ = key;
  end; 

end;
/

ĄŒŧŽĀ“I‚ČƒR[ƒh—á

Option Explicit

'** oo4o •Ï”éŒū
  dim OraSession
  dim OraDatabase
  dim qurs

'=======================================================================
'  €”õ
'=======================================================================
Private Sub Form_Load()

  dim dbname as string
  dim cnuser as string

'** ƒGƒ‰[ƒgƒ‰ƒbƒvŠJŽn
  on local error resume next

'** ƒAƒCƒLƒƒƒbƒ`•\ŽĶ
  'Load FormLogo
  'FormLogo.Show
  'DoEvents
  '// Ú‘ą‚É 10 •b‚Ų‚Į‚Đ‚Đ‚é‚Ė‚ŁAuƒf[ƒ^ƒx[ƒXÚ‘ą’†...v‚Č‚Į‚Ė
  '// ƒ‚[ƒhƒŒƒXƒ_ƒCƒAƒƒO‚ð•\ŽĶ‚·‚é‚Æ—Į‚ĒB

'** ƒT[ƒrƒXAƒ†[ƒUÝ’č
  dbname = ""
  cnuser = "SAK/SAK"
  '// Oracle ƒT[ƒrƒX–ž(•Ę–ž)Aƒ†[ƒUEƒpƒXƒ[ƒhŽw’č

'** oo4o Ú‘ą
  Set OraSession = CreateObject("OracleInProcServer.XOraSession")
  if err <> 0 then
    MsgBox "ƒf[ƒ^ƒx[ƒX‚ɐڑąo—ˆ‚Ü‚đ‚ņB" & chr(10) _
      & "CreateObject - Oracle oo4o ƒGƒ‰["
    end
  end if
  Set OraDatabase = OraSession.OpenDatabase(dbname, cnuser, ORADB_DEFAULT)
  if err <> 0 then
    MsgBox "ƒf[ƒ^ƒx[ƒX‚ɐڑąo—ˆ‚Ü‚đ‚ņB" & chr(10) _
      & err & ": " & error
    end
  end if

'** ƒpƒ‰ƒƒ^’Į‰Á
  OraDatabase.Parameters.Add "ƒL[", 0, ORAPARM_INPUT
  OraDatabase.Parameters("ƒL[").ServerType = ORATYPE_CHAR
  if err <> 0 or OraDatabase.LastServerErr <> 0 then
    MsgBox "ƒpƒ‰ƒƒ^’Į‰Á‚ÉŽļ”s‚ĩ‚Ü‚ĩ‚―B" & chr(10) _
      & err & ": " & error & chr(10) _
      & "oo4o: " & OraDatabase.LastServerErrText
    end
  end if

'** ƒŠƒNƒGƒŠƒŒƒR[ƒhƒZƒbƒgƒI[ƒvƒ“
  set qurs = OraDatabase.CreatePLSQLDynaset("Begin testp.GetTestm " _
    & "(:ƒL[, :cu); end;", "cu", ORADYN_DEFAULT)
  if err <> 0 or OraDatabase.LastServerErr <> 0 then
    MsgBox "ƒŠƒNƒGƒŠƒŒƒR[ƒhƒZƒbƒgƒI[ƒvƒ“‚ÉŽļ”s‚ĩ‚Ü‚ĩ‚―B" & chr(10) _
      & err & ": " & error & chr(10) _
      & "oo4o: " & OraDatabase.LastServerErrText
    end
  end if

'** ƒAƒCƒLƒƒƒbƒ`I—đ
  'Unload FormLogo
  '// Ú‘ą‚ŠŠŪ—đ‚·‚ę‚΁Auƒf[ƒ^ƒx[ƒXÚ‘ą’†...v‚ðƒNƒ[ƒY‚·‚éB

'** ƒGƒ‰[ƒgƒ‰ƒbƒvI—đ
  on local error goto 0

End Sub

'=======================================================================
'  ŒãŽn––
'=======================================================================
Private Sub Form_Unload(Cancel As Integer)

'** ƒŠƒNƒGƒŠƒŒƒR[ƒhƒZƒbƒgƒNƒ[ƒY
  Set qurs = Nothing

'** ƒpƒ‰ƒƒ^‰ðÁ
  OraDatabase.Parameters.Remove "ƒL["

'** oo4o Ú‘ą‰ðœ
  Set OraDatabase = Nothing
  Set OraSession = Nothing

End Sub

'=======================================================================
'  ƒƒCƒ“
'=======================================================================
Private Sub Command1_Click()

'** ƒŠƒNƒGƒŠ
  OraDatabase.Parameters("ƒL[").value = "a001"
  qurs.Refresh
  if qurs.EOF then
    print "a001 not found"
  else
    print qurs("ƒL[")
  end if

'** ƒŠƒNƒGƒŠ
  OraDatabase.Parameters("ƒL[").value = "b002"
  qurs.Refresh
  if qurs.EOF then
    print "b002 not found"
  else
    print qurs("ƒL[")
  end if

  print "-- I—đ --"

End Sub

ĄVB oo4o + SQL ‰ž—p•ŌŽ‘—ŋ
ĄVB ADO + SQL ‰ž—p•ŌŽ‘—ŋ
ĄVB RDO + SQL ‰ž—p•ŌŽ‘—ŋ
ĄSQL Šî‘b•ŌŽ‘—ŋ
ĄSQL Šî‘bŽĀ’n•ŌŽ‘—ŋ
ĄSQL ƒ`ƒ…[ƒjƒ“ƒO•ŌŽ‘—ŋ
ĄOracle PL/SQL •ŌŽ‘—ŋ
ĄPostgreSQL •ŌAJAVA ServletAJSP •ŌŽ‘—ŋ
ĄMySQL •ŌŽ‘—ŋ
ĄVB “ü–å•ŌŽ‘—ŋ
ĄVB Šî‘b•ŌŽ‘—ŋ
ĄVB ƒrƒWƒ…ƒAƒ‹•ŌŽ‘—ŋ
ĄVB ƒeƒNƒjƒbƒN•ŌŽ‘—ŋ
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠŲEƒJƒtƒF ˆę—— SAK Streets ŒŸõ



Copyright (C) 1999-2017 Y.SAK