Background Image

FORUM

조회 수 395 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

* 질문 등록 시 다음의 내용을 꼭 기입하여 주세요.
OS
Window7 32bit, Linux 64bit 등
CUBRID Ver.
[cubrid_rel] 수행 결과
CUBRID TOOL Ver.
[도움말]-[버전정보] 확인
응용 환경(API)
java, php, odbc 등 입력

* CUBRID 응용 오류, SQL 오류 또는 SQL 튜닝 관련된 문의는 반드시 다음의 내용을 추가해 주세요. 비밀글이나 비밀 댓글도 가능합니다.
* 저희가 상황을 이해하고, 재현이 가능해야 알 수 있는 문제들이 많습니다. 가능한 정보/정황들을 부탁합니다.
에러 내용 및 재현 방법 재현 가능한 Source와 SQL
관련 테이블(인덱스, 키정보 포함) 정보 CUBRID 홈 디렉토리 아래 log 디렉토리 압축


-------------- 아래에 질문 사항을 기입해 주세요. ------------------------------------------------------------------------ 

예전에 Maria DB 등 다른 RDBMS에서 MyBatis를 활용할 때에는 auto_increment된 key값을 insert의 반환값으로 얻기 위해 usegeneratedkeys 옵션을 사용해주었는데, Cubrid에서는 해당 옵션이 사용 불가능한 것 같습니다. 검색하여 얻은 <selectKey>도 동작을 하지 않는 것 같은데, 다른 방법이 혹시 있나요?​
(https://www.cubrid.com/qna/3815047)​

  • ?
    큐브리드_김주현 2021.01.04 14:17
    큐브리드를 이용해주셔서 감사합니다.

    auto_increment로 테이블을 생성 한 후, INSERT된 값의 values를 가져오고자 하는 것으로 이해 됩니다.
    CUBRID에서 auto_increment 생성 시, db_serical에 등록되며
    현재값은 serial_id.current_value로 , 그 다음값은 serial_id.next_value로 호출 하여 사용 하시면 되겠습니다.

    //예제 - 테이블 생성
    CREATE TABLE auto_tbl (id INT AUTO_INCREMENT, name VARCHAR);
    INSERT INTO auto_tbl VALUES (NULL, 'AAA'), (NULL, 'BBB'), (NULL, 'CCC'); //1,2,3 증가
    INSERT INTO auto_tbl (name) VALUES ('DDD'), ('EEE'); //4,5 증가
    SELECT * FROM auto_tbl;


    select * from db_serial where class_name = 'auto_tbl'; //생성된 테이블의 serial명 검색
    === <Result of SELECT Command in Line 1> ===

    name owner current_val increment_val max_val min_val cyclic started class_name att_
    name cached_num comment
    ==========================================================================================================================================================================================
    ===================================================
    'auto_tbl_ai_id' db_user 5 1 2147483647 1 0 1 'auto_tbl' 'id'
    0 NULL

    1 row selected. (0.003445 sec) Committed.


    INSERT INTO auto_tbl (name) VALUES ('zzz'); // 6 증가
    select auto_tbl_ai_id.CURRENT_VALUE; //현재 입력된 serial값 조회

    === <Result of SELECT Command in Line 1> ===

    serial_current_value(auto_tbl_ai_id)
    ======================
    6

    참고 : https://www.cubrid.org/manual/ko/10.1/sql/schema/serial_stmt.html#id1

  1. SQLGate for CUBRID 영구 무료 라이선스 제공

    Date2020.04.09 Byadmin Views4442
    read more
  2. 같은 그룹에 속한 OS계정에서의 csql접속

    Date2023.11.22 Byf0081 Views109
    Read More
  3. 비슷한 조건의 환경에서 select 질의시 오류가 발생합니다.

    Date2023.11.21 Bymsbb8585 Views103
    Read More
  4. 임시볼륨 늘어나는 문제

    Date2023.11.21 Byangdoo Views96
    Read More
  5. DB 데이터 이전 관련

    Date2023.11.20 By별린 Views120
    Read More
  6. Java Maven Repository

    Date2023.11.16 By내멋으로 Views121
    Read More
  7. Cubrid의 Window 버전의 Broker Port 구성 방식

    Date2023.11.15 Byjhlee Views98
    Read More
  8. [CUBRID Admin] ENUM 데이터 내보내기

    Date2023.11.14 Bytree1891 Views109
    Read More
  9. CUBRIDException: Data type references are incompatible. 에러관련 쿼리질문

    Date2023.11.14 Byyhpark Views218
    Read More
  10. 사용자 삭제 시 소유한 오브젝트를 함께 삭제하는 방법

    Date2023.11.14 Byf0081 Views134
    Read More
  11. unloaddb 에러 확인 요청.

    Date2023.11.13 By정현 Views91
    Read More
  12. 유저생성 함수 반복 실행 시, fatal error발생

    Date2023.11.09 Byf0081 Views102
    Read More
  13. 11.2버전에서 사용자 스키마에 대해서 궁금한 것이 있습니다.

    Date2023.11.08 By로키 Views138
    Read More
  14. 저장프로시저 실행관련 문의

    Date2023.11.08 Byf0081 Views138
    Read More
  15. 다른 소유자 테이블 검색 권한

    Date2023.11.08 By박혀누 Views135
    Read More
  16. [CUBRID Admin] 사용자의 테이블 권한 편집

    Date2023.11.06 Bytree1891 Views97
    Read More
  17. 3909번 답변 좀 부탁드립니다.

    Date2023.11.06 Byf0081 Views91
    Read More
  18. [CUBRID Admin] 테이블 컬럼 순서 변경 불가

    Date2023.11.05 Bytree1891 Views178
    Read More
  19. 시스템 카탈로그 조회 외

    Date2023.11.01 Byf0081 Views121
    Read More
  20. 시리얼 생성 시 class_name, attr_name, started 컬럼 값을 변경하고 싶습니다.

    Date2023.11.01 Bygetpost Views111
    Read More
  21. cubrid 9.3.1 설치해서 원격으로 접속하고자 설치했는데 에러가 뜹니다

    Date2023.10.27 ByXstar Views97
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 200 Next
/ 200

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales