database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
ㆍInformix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Informix Q&A 1839 게시물 읽기
No. 1839
lock에 관한 질문입니다...
작성자
보그니
작성일
2003-11-11 17:01
조회수
5,272

table-a 에 숫자 4자리로 일련번호를 가지고 있고,
table-a 에서 일련번호를 가져와 +1 해서 다시 table-a에 update 하려고 합니다.
조회하고 update 할 동안 다른 사용자에서는 접근을 못하게 하여
사용자 마다 한번씩 일련번호가 +1 되게 하려하는데 어찌하면 좋을지...
ASP를 사용하여 아래 처럼 사용해 왔었는데 table-a 에서 같은 값을 가져오는 경우가 있는거
같습니다. 한번 봐주시고 틀린점 있으면 지적해주시면 감사하겠습니다.

 

Set recpos = Server.createObject("ADODB.Connection")
set recpos99 = server.CreateObject ("ADODB.RECORDSET")
recpos.open Application("objconn_str")

recpos.Execute "set lock mode to wait 150"
recpos.execute "set isolation to repeatable read"

recpos.BeginTrans

   call ct99_update()

   recpos.Execute sqlstr
   recpos99.close
 
   if Err.number = 0 then
      recpos.CommitTrans
      recpos.execute "set isolation to committed read"    
   else
      Response.Write Err.Description
      recpos.RollbackTrans 
   end if   
 
   set recpos99 = nothing
   set recpos = nothing

sub ct99_update()
   sqlstr = " select 일련번호 from table-a for update" 
   recpos99.Open sqlstr, recpos

   sqlstr = " update ct99 set " & _
            " 일련번호 =  " & 일련번호 + 1
end sub

[Top]
No.
제목
작성자
작성일
조회
1842ESQL/C 컴파일시 cannot open.... 오류 [1]
지지
2003-11-14
4735
1841Transactions not supported 에러에 관해... [2]
박상욱
2003-11-12
5407
1840특정user를 막고 싶습니다. [2]
권규용
2003-11-12
4315
1839lock에 관한 질문입니다...
보그니
2003-11-11
5272
1838help help jdbcError Notice!!!!!!!! help help
이이이
2003-11-10
4782
1837다음과 같은 조건을 만족하는 SQL 작성이 가능한 지... [2]
골뱅이
2003-11-07
4910
1835설치시 에러 질문~!! [2]
youngha
2003-11-01
5463
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.052초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다