SAK }‘ŠÙ
ASP VB Script oo4o + SQL ‰ž—p•Ò10 oo4o ƒXƒgƒAƒh - 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 (OraDynasetAƒ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—á <%@ Language=VBScript %> <% '======================================================================= ' €”õ '======================================================================= Public Const ORADB_DEFAULT = &H0 Public Const ORADYN_DEFAULT = &H0 Public Const ORADYN_NO_AUTOBIND = &H1 Public Const ORADYN_NO_BLANKSTRIP = &H2 Public Const ORADYN_READONLY = &H4 Public Const ORADYN_NOCACHE = &H8 Public Const ORADYN_ORAMODE = &H10 Public Const ORADYN_DBDEFAULT = &H20 Public Const ORADYN_NO_MOVEFIRST = &H40 Public Const ORADYN_DIRTY_WRITE = &H80 Public Const ORAPARM_INPUT = 1 Public Const ORAPARM_OUTPUT = 2 Public Const ORAPARM_BOTH = 3 Public Const ORATYPE_VARCHAR2 = 1 Public Const ORATYPE_NUMBER = 2 Public Const ORATYPE_SINT = 3 Public Const ORATYPE_FLOAT = 4 Public Const ORATYPE_STRING = 5 Public Const ORATYPE_VARCHAR = 9 Public Const ORATYPE_DATE = 12 Public Const ORATYPE_UINT = 68 Public Const ORATYPE_CHAR = 96 Public Const ORATYPE_CHARZ = 97 Public Const ORATYPE_CURSOR = 102 dim dbname dim cnuser '** ƒGƒ‰[ƒgƒ‰ƒbƒvŠJŽn on error resume next '** ƒT[ƒrƒXAƒ†[ƒUÝ’è dbname = "" cnuser = "SAK/SAK" '// Oracle ƒT[ƒrƒX–¼(•Ê–¼)Aƒ†[ƒUEƒpƒXƒ[ƒhŽw’è '** oo4o Ú‘± if isempty(session("OraSession")) then Set session("OraSession") = Server.CreateObject("OracleInProcServer.XOraSession") if err <> 0 then response.write("<P>ƒf[ƒ^ƒx[ƒX‚ÉÚ‘±o—ˆ‚Ü‚¹‚ñB<BR>" _ & "CreateObject - Oracle oo4o ƒGƒ‰[</P>") end if end if if isempty(session("OraDatabase")) then Set session("OraDatabase") = session("OraSession").OpenDatabase(dbname, cnuser, ORADB_DEFAULT) if err <> 0 then response.write("<P>ƒf[ƒ^ƒx[ƒX‚ÉÚ‘±o—ˆ‚Ü‚¹‚ñB<BR>" _ & err & ": " & error & "</P>") end if end if '** ƒpƒ‰ƒƒ^’ljÁ if isempty(session("ParaAdd")) then session("OraDatabase").Parameters.Add "ƒL[", 0, ORAPARM_INPUT session("OraDatabase").Parameters("ƒL[").ServerType = ORATYPE_CHAR if err <> 0 or session("OraDatabase").LastServerErr <> 0 then response.write("<P>ƒpƒ‰ƒƒ^’ljÁ‚ÉŽ¸”s‚µ‚Ü‚µ‚½B<BR>" _ & err & ": " & error & "<BR>" _ & "oo4o: " & session("OraDatabase").LastServerErrText & "</P>") else session("ParaAdd") = true end if end if '** ƒŠƒNƒGƒŠƒŒƒR[ƒhƒZƒbƒgƒI[ƒvƒ“ if isempty(session("qurs")) then set session("qurs") = session("OraDatabase").CreatePLSQLDynaset("Begin testp.GetTestm " _ & "(:ƒL[, :cu); end;", "cu", ORADYN_DEFAULT) if err <> 0 or session("OraDatabase").LastServerErr <> 0 then response.write("<P>ƒŠƒNƒGƒŠƒŒƒR[ƒhƒZƒbƒgƒI[ƒvƒ“‚ÉŽ¸”s‚µ‚Ü‚µ‚½B<BR>" _ & err & ": " & error & "<BR>" _ & "oo4o: " & session("OraDatabase").LastServerErrText & "</P>") end if end if '** ƒGƒ‰[ƒgƒ‰ƒbƒvI—¹ on error goto 0 '======================================================================= ' ˆ— '======================================================================= '** ƒŠƒNƒGƒŠ session("OraDatabase").Parameters("ƒL[").value = "a001" session("qurs").Refresh if session("qurs").EOF then response.write("<P>a001 not found</P>") else response.write("<P>" & session("qurs")("ƒL[") & "</P>") end if '** ƒŠƒNƒGƒŠ session("OraDatabase").Parameters("ƒL[").value = "b002" session("qurs").Refresh if session("qurs").EOF then response.write("<P>b002 not found</P>") else response.write("<P>" & session("qurs")("ƒL[") & "</P>") end if response.write("<P>-- I—¹ --</P>") %> ¡ASP VB Script oo4o + SQL ‰ž—p•ÒŽ‘—¿
¡ASP VB Script ADO + SQL ‰ž—p•ÒŽ‘—¿
¡ASP VB Script Šî‘bŽÀ’n•ÒŽ‘—¿
¡ASP VB Script Šî‘b•ÒŽ‘—¿
¡SQL Šî‘b•ÒŽ‘—¿
¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
¡SQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—¿
¡Oracle PL/SQL •ÒŽ‘—¿
¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡MySQL •ÒŽ‘—¿