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‚Ì“ü—́Ao—́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ƒXAƒ†[ƒUÝ’è
  dbname = ""
  cnuser = "SAK/SAK"
  '// Oracle ƒT[ƒrƒX–¼(•Ê–¼)Aƒ†[ƒUEƒ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ƒvI—¹
  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 ServletAJSP •ÒŽ‘—¿
¡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-2017 Y.SAK