Prepared Statement ?


1. 생성

형식

PREPARE {구문명} AS
{쿼리};
PREPARE {구문명} ( {파라미터 목록} )  AS
{쿼리};

예시

PREPARE CHECK_RD_YET AS
SELECT
    (SELECT COUNT(*) FROM RD_ADM_DSTRT   WHERE PROC_YN = '0') AS RD_ADM_DSTRT
   ,(SELECT COUNT(*) FROM RD_ADM_COORDS  WHERE PROC_YN = '0') AS RD_ADM_COORDS
;
-- 선언
PREPARE SHOW_MAPPR(INT, INT) AS
SELECT * FROM CB_ADDR_MAPPR WHERE LV = $1 LIMIT $2;

-- 실행
EXECUTE SHOW_MAPPR(3, 50);

2. 제거

형식

DEALLOCATE PREPARE {구문명};