INSERT 다른테이블내용 조회후 입력
INSERT INTO COMPANY( COMPANY_NO , COMPANY_GUBUN , CRD_DT , COMPANY_CODE , COMPANY_NM ) SELECT COMPANY_SEQ.NEXTVAL AS COMPANY_NO , '1' AS COMPANY_GUBUN , SYSDATE AS CRD_DT , A.COMPANY_CODE , A.COMPANY_NM FROM ( SELECT SUBSTR(PUB_CD,3,4) AS COMPANY_CODE ,PUB_NM AS COMPANY_NM FROM TEXTBOOK GROUP BY PUB_CD,PUB_NM ORDER BY PUB_CD ASC ) A 설명 : TEXTBOOK에 INSERT 된 PUB_CD(기관코드),PUB_NM(기관명) GROUP BY 해서 조회..
DBMS/Oracle
2012. 11. 14. 11:56