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 |

ASP VB Script oo4o + SQL ‰ž—p•Ò9 oo4o ƒXƒgƒAƒhƒtƒ@ƒ“ƒNƒVƒ‡ƒ“ - PL/SQL

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

¡ƒXƒgƒAƒhƒtƒ@ƒ“ƒNƒVƒ‡ƒ“ / ƒXƒgƒAƒhƒvƒƒVƒWƒƒ

  EExecuteSql ‚Å‚ÌŽÀs

  Dim pret

'** ƒpƒ‰ƒƒ^’ljÁ
  session("OraDatabase").Parameters.Add "ret", 0, ORAPARM_OUTPUT
  set pret = session("OraDatabase").Parameters("ret")
  pret.ServerType = ORATYPE_VARCHAR2

'** ƒXƒgƒAƒhƒtƒ@ƒ“ƒNƒVƒ‡ƒ“ŽÀs
  session("OraDatabase").ExecuteSql "begin :ret := sak.GetTmp(); end;"

'** –ß‚è’lŽæ“¾
  response.write("<P>" & pret.value & "</P>")

'** ƒpƒ‰ƒƒ^‰ðÁ
  session("OraDatabase").Parameters.Remove "ret"

  ECreateSql ‚Å‚ÌŽÀs

  Dim pret

'** SQL ì¬
  Set session("OraSqlStmt") = session("OraDatabase").CreateSql("begin :ret := sak.GetTmp(); end;" _
    , ORASQL_DEFAULT)

'** ƒpƒ‰ƒƒ^’ljÁ
  session("OraDatabase").Parameters.Add "ret", 0, ORAPARM_OUTPUT
  set pret = session("OraDatabase").Parameters("ret")
  pret.ServerType = ORATYPE_VARCHAR2

'** ƒXƒgƒAƒhƒtƒ@ƒ“ƒNƒVƒ‡ƒ“ŽÀs
  session("OraSqlStmt").Refresh

'** –ß‚è’lŽæ“¾
  response.write("<P>" & pret.value & "</P>")

'** ƒpƒ‰ƒƒ^‰ðÁ
  session("OraDatabase").Parameters.Remove "ret"

'** ƒpƒ‰ƒƒ^ƒNƒGƒŠ‰ðÁ
  Set session("OraSqlStmt") = Nothing

¡•â‘«

  E–ß‚è’lˆÈŠO‚Ì“ü—ÍAo—ÍA“üo—̓pƒ‰ƒƒ^‚à’Êí‚̃oƒCƒ“ƒh•Ï”‚ŃAƒNƒZƒX
    ‚·‚ê‚Ηǂ¢B"begin :ret := sak.GetTmp(:para1, :para2); end;"

  E–ß‚è’l‚ª‚È‚¢ê‡‚ÍA"begin sak.GetTmp(:para1, :para2); end;" ‚Æ‚È‚éB

  EƒXƒgƒAƒh‚ÌŽÀs‚ÉŒÀ‚炸Abegin ... end; ‚Ì PL/SQL ƒuƒƒbƒN‚ðˆ—‚·‚é
    ‚±‚Æ‚ª‚Å‚«‚éBbegin ... end; ‚Å‚Ü‚Æ‚ß‚ç‚ê‚é‚à‚Ì‚ÍAˆê“x‚É”­s‚µ‚½•û
    ‚ªƒŒƒXƒ|ƒ“ƒX‚Í—Ç‚¢B

¡Œ»ŽÀ“I‚ȃR[ƒh—á

<%@ Language=VBScript %>
<%
'=======================================================================
'  €”õ
'=======================================================================
  Public Const ORADB_DEFAULT   = &H0
  Public Const ORASQL_DEFAULT     = &H0
  Public Const ORASQL_NO_AUTOBIND = &H1
  Public Const ORASQL_FAILEXEC    = &H2
  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

'** SQL ì¬
  if isobject(session("OraSQLStmt")) = false then
    Set session("OraSqlStmt") = session("OraDatabase").CreateSql("begin :ret := sak.GetTmp(); end;" _
      , ORASQL_DEFAULT)
    if session("OraDatabase").LastServerErr = 1008 then session("OraDatabase").LastServerErrReset
    if err <> 0 or session("OraDatabase").LastServerErr <> 0 then
      response.write("<P>SQL 쬂Ɏ¸”s‚µ‚Ü‚µ‚½B<BR>" _
        & err & ": " & error & "<BR>" _
        & "oo4o: " & session("OraDatabase").LastServerErrText & "</P>")
    end if
  end if

'** ƒpƒ‰ƒƒ^’ljÁ
  if isempty(session("ParaAdd")) then
    session("OraDatabase").Parameters.Add "ret", 0, ORAPARM_OUTPUT
    session("OraDatabase").Parameters("ret").ServerType = ORATYPE_VARCHAR2
    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

'** ƒGƒ‰[ƒgƒ‰ƒbƒvI—¹
  on error goto 0

'=======================================================================
'  ˆ—
'=======================================================================

'---- ExecuteSql ‚Å‚ÌŽÀs ----
  response.write("<P>-- ExecuteSql ‚Å‚ÌŽÀs --</P>")

'** ƒXƒgƒAƒhƒtƒ@ƒ“ƒNƒVƒ‡ƒ“ŽÀs
  session("OraDatabase").ExecuteSql "begin :ret := sak.GetTmp(); end;"

'** –ß‚è’lŽæ“¾
  response.write("<P>" & session("OraDatabase").Parameters("ret").value & "</P>")

'** ƒŒƒR[ƒhƒZƒbƒgƒNƒ[ƒY
  set rs = Nothing

'---- CreateSql ‚Å‚ÌŽÀs ----
  response.write("<P>-- CreateSql ‚Å‚ÌŽÀs --</P>")

'** ƒXƒgƒAƒhƒtƒ@ƒ“ƒNƒVƒ‡ƒ“ŽÀs
  session("OraSqlStmt").Refresh

'** –ß‚è’lŽæ“¾
  response.write("<P>" & session("OraDatabase").Parameters("ret").value & "</P>")

  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 •ÒŽ‘—¿
| 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-2024 Y.SAK