본문 바로가기

IT 기술/코드샘플

[mybatis] INSERT 전에 테이블 존재유무 체크하기

한방쿼리를 원할때 사용

INSERT INTO temp (COL_NM) select '1'
from DUAL
WHERE EXISTS( SELECT 1 FROM Information_schema.tables
  WHERE 
   table_name = 'temp')