구름과 바람 그리고 나그네 :: [asp] CLOB 데이터 저장, 읽기

CLOB 데이터 넣기


'저장할 SEQ를 가져옴.
SQL = "SELECT (SEQ 이름.NEXTVAL) AS SEQ FROM DUAL"
nSeq = rs("SEQ")


SQL = "INSERT INTO 테이블(NO, CONTENT) VALUES(?, EMPTY_CLOB())"
Set cmd = Server.CreateObject("ADODB.Command")

With cmd
.ActiveConnection = connectString
.CommandType = adCmdText
.CommandText = sql
.Parameters.Append .CreateParameter("@nSeq", adInteger, adParamInput, ,no)
.Execute
End With

SQL = "UPDATE 테이블 SET CONTENT=? WHERE NO=?"

set ocmd = Server.CreateObject("ADODB.Command")

With ocmd
.ActiveConnection = cn
.CommandType = adCmdText
.CommandText = sql

.Parameters.Append .CreateParameter("@content", adLongVarWChar, adParamInput, 40000,content)
.Parameters.Append .CreateParameter("@nSeq", adInteger, adParamInput, ,no)
.Execute
End With

=======================================================

clob데이터 읽기


Dim ClobLength

SQL ="SELECT DBMS_LOB.GETLENGTH(CONTENT) AS CLOBLENGTH FROM 테이블 이름 WHERE NO="&nSeq

ClobLength = rs(0)

'clob의 데이터 길이를 ClobLength값에 넣음.

SQL ="SELECT DBMS_LOB.SUBSTR(CONTENT,"& ClobLength &", 1) AS CONTENT FROM 테이블 WHERE NO="&nSeq

Set rs = cn.Execute(sql)

데이터길이 만큼 읽음.

'개발 > asp' 카테고리의 다른 글

[asp]Request.ServerVariables  (0) 2018.07.04
[asp] 다른사이트 불러오기  (0) 2011.12.16
[asp] Decode된걸 복구하기  (0) 2011.08.25
[asp] RegExp를 이용한 정규식(?)  (0) 2010.08.18
[ASP] DateAdd함수  (0) 2010.07.14
Posted by pressrain
,