2015. 4. 23. 18:02ㆍDatabase/공통
MySql
<insert id="insertContent" parameterClass="content">
<![CDATA[
INSERT INTO CONTENT (
CREATED_DATE, TITLE, CONTENT, CONTENT_TYPE
) VALUES (
now(), #title#, #content#, #contentType#
)
]]>
<selectKey keyProperty="seqId" resultClass="int">
SELECT LAST_INSERT_ID()
</selectKey>
</insert>
MSSQL
<insert id="createProjectBasicInfo" parameterClass="prjIdx">
<selectKey keyProperty="prj_info_seq" resultClass="int">
INSERT INTO PRJ_INFO ( ... ) VALUES ( ... )
SELECT SCOPE_IDENTITY()
</selectKey>
</insert>
Oracle
<insert id="insert_message" parameterClass="java.util.HashMap">
<selectKey keyProperty="message_id" resultClass="Integer">
SELECT message_id_seq.nextval FROM DUAL
</selectKey>
INSERT INTO guestbook_message (
message_id, guest_name, password, message
) VALUES(
#message_id#, #gName#, #pw#, #ms#
)
</insert>
'Database > 공통' 카테고리의 다른 글
DATABASE별 결과 값 RANDOM 으로 나오게 하기 (0) | 2015.04.23 |
---|