{"id":3624,"date":"2018-03-19T10:24:25","date_gmt":"2018-03-19T01:24:25","guid":{"rendered":"http:\/\/haisins.epac.to\/wordpress\/?p=3624"},"modified":"2018-03-19T10:27:49","modified_gmt":"2018-03-19T01:27:49","slug":"dynamic-sql","status":"publish","type":"post","link":"http:\/\/haisins.synology.me\/wordpress\/?p=3624","title":{"rendered":"Dynamic SQL"},"content":{"rendered":"<p><span style=\"font-family: HY\uc911\uace0\ub515;\">Dynamic SQL, \ub3d9\uc801 SQL\uc740 \uc0c1\ud669\uc5d0 \ub530\ub77c \uac00\ubcc0\uc801\uc73c\ub85c \uc0ac\uc6a9\ub418\ub294 SQL\uc744 \uc758\ubbf8\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">Dynamic SQL\uc758 \uae30\ubcf8\uc801 \uac1c\ub150 \ubc0f \uc0ac\uc6a9\ubc95\uc744 \ub2e4\ub8e8\ub3c4\ub85d \ud558\uaca0\ub2e4.<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<div style=\"text-align: justify;\">\n<h1><span style=\"font-family: HY\uc911\uace0\ub515;\">Dynamic SQL?<br \/>\n<\/span><\/h1>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub300\ubd80\ubd84\uc758 \ub370\uc774\ud0c0\ubca0\uc774\uc2a4 \uc751\uc6a9\ud504\ub85c\uadf8\ub7a8\uc740 \ud2b9\uc815\ud55c \uc77c\uc744 \ud55c\ub2e4. \uc608\ub97c \ub4e4\uba74, \ub2e8\uc21c\ud55c \uac83\uc73c\ub85c \uc0ac\uc6a9\uc790\uc758 \uc0ac\ubc88\uc744 \ubb3b\uace0, EMP\ub098 DEPT \ud14c\uc774\ube14 \ub4f1\uc744 \uac31\uc2e0\ud558\ub294 \uac83\uc774 \uc788\ub2e4. <\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc774\ub7f0 \uacbd\uc6b0, \ucef4\ud30c\uc77c \ud558\uae30 \uc804\uc5d0 UPDATE \ubb38\uc744 \uad6c\uc131\ud558\ub294 \uac83\ub4e4\uc744 \uc54c\uace0 \uc788\uac8c \ub41c\ub2e4. <\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc989, \uc5b4\ub5a4 \ud14c\uc774\ube14\uc774 \ubcc0\ud654\ub418\uc5b4\uc57c \ud560 \uac83\uc778\uc9c0, \uac01 \ud14c\uc774\ube14\uacfc \uceec\ub7fc\uc5d0 \uc815\uc758\ub41c \uc81c\ud55c\uc810, \uac01 \uceec\ub7fc\uc758 \ub370\uc774\ud0c0 \ud0c0\uc785 \ub4f1\uc774 \uc774\uc5d0 \ud574\ub2f9\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uadf8\ub7ec\ub098, \uc5b4\ub5a4 \uc751\uc6a9\ud504\ub85c\uadf8\ub7a8\ub4e4\uc740 \uc2e4\ud589 \uc2dc SQL\ubb38\uc758 \ubcc0\ud654\ub97c \uc218\uc6a9\ud574\uc57c\ub9cc \ud55c\ub2e4. <\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc608\ub97c \ub4e4\uc5b4 \uc77c\ubc18\uc801 \ubaa9\uc801\uc758 \ub9ac\ud3ec\ud2b8 writer\ub294 \ucc98\ub9ac\ud574\uc57c \ud560 \ub2e4\uc591\ud55c \ub9ac\ud3ec\ud2b8\uc5d0 \ub530\ub77c SELECT \ubb38\uc744 \uc11c\ub85c \ub2e4\ub974\uac8c \uad6c\ucd95\ud55c\ub2e4. <\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc774 \uacbd\uc6b0, \uc2e4\ud589 \uc774\uc804\uc5d0 \ubb38\uc7a5\uc758 \uad6c\uc131\uc744 \uc54c \uc218\ub294 \uc5c6\ub2e4. \uc774\ub7f0 \ubb38\uc7a5\ub4e4\uc740 \uc2e4\ud589 \uc0c1\uc5d0 \uc788\uc5b4\uc11c \ubcc0\ud654\ub420 \uac83\uc774\ub2e4. \uc774\ub294 Dynamic SQL \ubb38\uc7a5\uc73c\ub85c \ubd88\ub9b0\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc815\uc801\uc778 SQL \ubb38\uacfc\ub294 \ub2ec\ub9ac, Dynamic SQL \ubb38\uc7a5\uc740 source program\uc5d0 \ucd94\uac00\ub418\uc9c0\ub294 \uc54a\ub294\ub2e4. \ub300\uc2e0, \ubb38\uc790\uc5f4 \uc785\ub825\uc73c\ub85c \ud504\ub85c\uadf8\ub7a8\uc5d0 \uc800\uc7a5\ub418\uac70\ub098, \ud504\ub85c\uadf8\ub7a8\uc5d0 \uc758\ud574 \uad6c\ucd95\ub41c\ub2e4. <\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc774\uac83\uc740 \uc0c1\ud638\uc791\uc6a9\uc801\uc73c\ub85c \uc785\ub825\ub418\uac70\ub098 file\ub85c \ubd80\ud130 \uc77d\ud600\uc9c4\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h1><\/h1>\n<h1><span style=\"font-family: HY\uc911\uace0\ub515;\">Dynamic SQL\uc758 \uc7a5\ub2e8\uc810<br \/>\n<\/span><\/h1>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub3d9\uc801\uc73c\ub85c \uc815\uc758\ub41c SQL \ubb38\uc7a5\uc744 \ubc1b\uc544\ub4e4\uc774\uace0 \ucc98\ub9ac\ud558\ub294 \ud638\uc2a4\ud2b8 \ud504\ub85c\uadf8\ub7a8\uc740 \ud3c9\ubc94\ud55c embedded SQL \ud504\ub85c\uadf8\ub7a8\ubcf4\ub2e4 \ubcc0\ub3d9\uc774 \uc2ec\ud558\ub2e4. \ub3d9\uc801 SQL\ubb38\uc7a5\uc740 SQL\uc5d0 \ub300\ud574 \uc804\ud600 \ubaa8\ub974\ub294 \uc0ac\uc6a9\uc790\ub85c \ubd80\ud130 \uc785\ub825\uc744 \ubc1b\uc544\ub4e4\uc5ec \uad6c\ucd95\ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc608\ub97c \ub4e4\uba74, \ub2f9\uc2e0\uc758 \ud504\ub85c\uadf8\ub7a8\uc740 \uc0ac\uc6a9\uc790\uc5d0\uac8c SELECT, UPDATE,DELETE \ubb38 \ub4f1\uc758 WHERE \uc808\uc5d0 \uc2dc\uc6a9\ub420 \uac80\uc0c9 \uc870\uac74\uc744 \uc694\uad6c\ud560 \uc218 \uc788\ub2e4. \ubcf4\ub2e4 \ubcf5\uc7a1\ud55c \ud504\ub85c\uadf8\ub7a8\uc740 \uc0ac\uc6a9\uc790\uc5d0\uac8c SQL \uc5f0\uc0b0\ub4e4, \ud14c\uc774\ube14\uacfc \ubdf0 \uc774\ub984\ub4e4, \uceec\ub7fc\uba85\ub4e4 \ub4f1\uc774 \ub098\uc5f4\ub41c \uba54\ub274\ub85c \ubd80\ud130 \uace8\ub77c\ub0b4\uae30\ub97c \ud5c8\uc6a9\ud560 \uc218\ub3c4 \uc788\ub2e4. \ub530\ub77c\uc11c \ub3d9\uc801 SQL\uc740 \ub9e4\uc6b0 \uc735\ud1b5\uc131\uc788\ub294 \uc751\uc6a9\ud504\ub85c\uadf8\ub7a8\uc744 \uc0ac\uc6a9\ud560 \uc218 \uc788\uac8c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uadf8\ub7ec\ub098, \uc5b4\ub5a4 \ub3d9\uc801 \ucffc\ub9ac\ub294 \ud2b9\uc218\ud55c \ub370\uc774\ud0c0 \uad6c\uc870\ub97c \uc0ac\uc6a9\ud558\uac70\ub098, \uc2e4\ud589\uc2dc\uac04\uc5d0 \ucc98\ub9ac\ud558\uac8c \ud558\ub294 \ubcf5\uc7a1\ud55c \ucf54\ub529\uc744 \uc694\uad6c\ud558\uae30\ub3c4 \ud55c\ub2e4. \uc5ec\ub7ec\ubd84\uc774 \ub3d9\uc801 SQL\uc758 \uac1c\ub150\uacfc \uae30\ubc95\uc744 \uc644\uc804\ud788 \uc219\uc9c0\ud558\uc9c0 \uc54a\ub294\ub2e4\uba74, \ucd94\uac00\uc801 \ucc98\ub9ac \uc2dc\uac04\uc744 \uc54c\uc9c0 \ubabb\ud558\ub294 \ub3d9\uc548, \ucf54\ub529\uc774 \uc5b4\ub835\ub2e4\ub294 \uac83\uc744 \ub290\ub084 \uc218 \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h1><\/h1>\n<h1><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc5b8\uc81c Dynamic SQL\uc744 \uc0ac\uc6a9\ud558\ub294\uac00<br \/>\n<\/span><\/h1>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc2e4\uc81c\uc801\uc73c\ub85c\ub294 \uc815\uc801 SQL\uc774 \uac70\uc758 \ubaa8\ub4e0 \ud504\ub85c\uadf8\ub798\ubc0d \uc694\uad6c\uc0ac\ud56d\uc744 \ub9cc\uc871\uc2dc\ud0ac \uac83\uc774\ub2e4. \ub3d9\uc801 SQL\uc740 \uc624\uc9c1 \uc644\uc804\ud55c \uc720\uc5f0\uc131\uc774 \ud544\uc694\ud560 \ub54c\ub9cc \uc4f0\ub3c4\ub85d \ud558\ub77c. \ub2e4\uc74c\uc5d0 \ub098\uc624\ub294 \ud56d\ubaa9 \uc911 \ud558\ub098\ub77c\ub3c4 \ucef4\ud30c\uc77c\ud558\uae30 \uc774\uc804\uc5d0 \ubd84\uba85\ud788 \uc54c \uc218 \uc5c6\ub2e4\uba74 \ub3d9\uc801 SQL\uc744 \uc0ac\uc6a9\ud560 \uac83\uc744 \uad8c\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<ul>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">SQL \ubb38\uc758 \ubb38\uad6c. (\uc0ac\uc6a9\ub420 \ubaa8\ub4e0 \uba85\ub839, \uc808 \ub4f1\ub4f1)<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uac2f\uc218. (\ub3d9\uc801\uc73c\ub85c \ubcc0\ud560 \uc218 \uc788\ub294\uac00)<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \ub370\uc774\ud0c0 \ud0c0\uc785.<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub370\uc774\ud0c0\ubca0\uc774\uc2a4 \uac1d\uccb4(\uceec\ub7fc, \uc778\ub371\uc2a4, \uc2dc\ud000\uc2a4, \ud14c\uc774\ube14, \uc0ac\uc6a9\uc790\uc774\ub984, \ubdf0)\ub97c \ucc38\uc870\ud558\ub294 \uac83.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h1><\/h1>\n<h1><span style=\"font-family: HY\uc911\uace0\ub515;\">Dynamic SQL\ubb38\uc758 \uc694\uad6c\uc0ac\ud56d<br \/>\n<\/span><\/h1>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub3d9\uc801 SQL\uc758 \ubb38\uc790\uc5f4\uc740 \uc801\uc808\ud55c SQL \ubb38\uc744 \ud3ec\ud568\ud558\uace0 \uc788\uc5b4\uc57c \ud558\uba70, EXEC SQL\uc774\ub098 \ubb38\uc7a5 \uc885\ub8cc \uae30\ud638, \ub610\ub294 \uc774\ud558\uc5d0 \ub098\uc624\ub294 embedded SQL \uba85\ub839\uc744 \ud3ec\ud568\ud574\uc11c\ub294 \uc548\ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<\/div>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">CLOSE<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">DECLARE<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">DESCRIBE<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">EXECUTE<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">FETCH<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">INCLUDE<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">OPEN<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">PREPARE<br \/>\n<\/span><\/div>\n<\/li>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">WHENEVER<br \/>\n<\/span><\/div>\n<\/li>\n<\/ul>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uac70\uc758 \ub300\ubd80\ubd84\uc758 \uacbd\uc6b0, \ubb38\uc790\uc5f4\uc740 <em>dummy<\/em> \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub4e4\uc744 \uac00\uc9c8 \uc218 \uc788\ub2e4. \uadf8\uac83\ub4e4\uc740 SQL\ubb38\uc5d0\uc11c \uc2e4\uc81c\ub85c \uc0ac\uc6a9\ub418\ub294 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc5d0 \ub300\ud574 \uc790\ub9ac\ub97c \uc7a1\ub294\ub2e4. Dummy \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub4e4\uc740 \uadf8\uc800 \uc790\ub9ac\ub97c \uc7a1\ub294 \uac83(placeholder)\uc774\ubbc0\ub85c, \uadf8\uac83\ub4e4\uc744 \uc120\uc5b8\ud558\uc9c0 \uc54a\uace0 \uc544\ubb34\ub807\uac8c\ub098 \uc774\ub984\uc744 \ubd99\uc5ec\ub3c4 \ub41c\ub2e4. Oracle\uc740 \uc544\ub798\uc5d0 \ub098\uc624\ub294 \ub450 \ubb38\uc7a5\uc5d0 \ub300\ud574 \ucc28\uc774\ub97c \ub450\uc9c0 \uc54a\ub294\ub2e4. :m\uacfc :j\ub294 \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub4e4\uc758 \uc790\ub9ac\ub97c \uc7a1\uc544\ub450\ub294 \uc5ed\ud560\ub9cc \ud558\ub294 \uac83\uc774\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515; font-size: 9pt;\">&#8216;DELETE FROM EMP WHERE MGR = :mgr_number AND JOB = :job_title&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515; font-size: 9pt;\">&#8216;DELETE FROM EMP WHERE MGR = :m AND JOB = :j&#8217;<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h1><\/h1>\n<h1><span style=\"font-family: HY\uc911\uace0\ub515;\">Dynamic SQL \ubb38\uc740 \uc5b4\ub5bb\uac8c \ucc98\ub9ac\ub418\ub294\uac00<br \/>\n<\/span><\/h1>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc804\ud615\uc801\uc73c\ub85c, \uc751\uc6a9\ud504\ub85c\uadf8\ub7a8\uc740 \uc0ac\uc6a9\uc790\uc5d0\uac8c SQL \ubb38\uc7a5\uacfc \uadf8 \ubb38\uc7a5\uc5d0\uc11c \uc0ac\uc6a9\ub41c \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uac12\uc744 \ubb3b\ub294\ub2e4. \uadf8\ub7ec\uace0 \ub098\uba74, Oracle\uc740 SQL \ubb38\uc7a5\uc744 <em>parse<\/em>\ud55c\ub2e4. \uc989, SQL \ubb38\uc7a5\uc774 \ubb38\uc7a5 \uaddc\uce59\uc744 \ub530\ub974\ub294\uc9c0, \uc801\uc808\ud55c \ub370\uc774\ud0c0\ubca0\uc774\uc2a4 \uac1d\uccb4\ub97c \ucc38\uc870\ud558\ub294\uc9c0 \ub4f1\uc744 \uac80\uc0ac\ud55c\ub2e4. Parsing\uc740 \ub610\ud55c \ub370\uc774\ud0c0\ubca0\uc774\uc2a4 \uc811\uadfc \uad8c\ud55c \uac80\uc0ac, \ud544\uc694\ud55c \uc790\uc6d0 \uc608\uc57d, \ucd5c\uc801\uc758 \uc811\uadfc \uacbd\ub85c \ucc3e\uae30 \ub4f1\uc744 \ud3ec\ud568\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub2e4\uc74c\uc73c\ub85c, Oracle\uc740 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc640 SQL \ubb38\uc7a5\uc744 <em>bind<\/em>\ud55c\ub2e4. \uc989, \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uc8fc\uc18c\ub97c \uc5bb\uc5b4\ub0b4\uc5b4 \uadf8 \uac12\uc744 \uc77d\uac70\ub098 \uc4f0\uac8c \ub418\ub294 \uac83\uc774\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uadf8 \ub2e4\uc74c\uc740 SQL \ubb38\uc7a5\uc744 <em>execute<\/em>\ud55c\ub2e4. \ud14c\uc774\ube14\uc5d0\uc11c \ud589\uc744 \uc0ad\uc81c\ud558\ub294 \ub530\uc704\uc758 SQL\ubb38 \uc694\uccad\uc744 \uc2e4\ud589\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">SQL \ubb38\uc7a5\uc740 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uc0c8\ub85c\uc6b4 \uac12\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubc18\ubcf5\uc801\uc73c\ub85c \uc2e4\ud589\ub420 \uc218 \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h1><\/h1>\n<h1><span style=\"font-family: HY\uc911\uace0\ub515;\">Dynamic SQL \uc0ac\uc6a9 \uae30\ubc95<br \/>\n<\/span><\/h1>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc5ec\uae30\uc11c\ub294 \ub3d9\uc801 SQL \ubb38\uc7a5\ub4e4\uc744 \uc815\uc758\ud558\ub294 \ub370\uc5d0 \uc0ac\uc6a9\ub420 \uc218 \uc788\ub294 \ub124\uac00\uc9c0 \uae30\ubc95 \uc911 \uae30\ubc95 1\uacfc \uae30\ubc952\ub97c \uc18c\uac1c\ud55c\ub2e4. \uac01 \uae30\ubc95\uc740 \ub2a5\ub825\uacfc \uc81c\ud55c\uc744 \uac04\ub7b5\ud788 \uc18c\uac1c\ud558\uace0, \uc801\uc808\ud55c \uae30\ubc95\uc744 \uc0ac\uc6a9\ud558\uae30 \uc704\ud55c \uac00\uc774\ub4dc\ub77c\uc778\uc744 \uc81c\uc2dc\ud55c\ub2e4. \ub2e4\uc74c \uc7a5\uc5d0\ub294 \uac01 \uae30\ubc95\uc758 \uc0ac\uc6a9(\uae30\ubc951,2)\uacfc sample \ud504\ub85c\uadf8\ub7a8(\uae30\ubc952)\uc774 \ub098\uc640 \uc788\ub2e4. \uae30\ubc953\uacfc 4\uc5d0 \ub300\ud574\uc11c\ub294 \uac01\uc790 \uacf5\ubd80\ud558\uae30\ub97c \ubc14\ub780\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub124 \uac00\uc9c0 \uae30\ubc95\ub4e4\uc740 \uc804\uccb4\uc801\uc778 \uac83\uc73c\ub85c \uc99d\uac00\ud55c\ub2e4. \uc989, \uae30\ubc952\ub294 \uae30\ubc951\uc744 \ud3ec\ud568\ud558\uba70, \uae30\ubc953\uc740 \uae30\ubc951\uacfc 2\ub97c \ud3ec\ud568\ud558\ub294 \ub4f1\uc774\ub2e4. \uadf8\ub7ec\ub098 \uac01 \uae30\ubc95\ub4e4\uc740 \ud2b9\uc815 \uc885\ub958\uc758 SQL \ubb38\uc7a5\uc744 \ub2e4\ub8e8\ub294 \ub370\uc5d0 \ub9e4\uc6b0 \uc720\uc6a9\ud558\ub2e4. \uc774\ud558 \ud45c\uc5d0 \uadf8 \uae30\ubc95\uacfc \uc885\ub958\uac00 \ub098\uc640 \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<div>\n<table style=\"border-collapse: collapse;\" border=\"0\">\n<colgroup>\n<col style=\"width: 87px;\" \/>\n<col style=\"width: 494px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr style=\"background: #e5e5e5;\">\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: solid 0.75pt; border-left: solid 0.75pt; border-bottom: double 0.75pt; border-right: solid 0.75pt;\">\n<p style=\"text-align: center;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc95<\/span><\/p>\n<\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: solid 0.75pt; border-left: none; border-bottom: double 0.75pt; border-right: solid 0.75pt;\">\n<p style=\"text-align: center;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">SQL \ubb38\uc7a5\uc758 \uc885\ub958<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.75pt; border-bottom: solid 0.75pt; border-right: solid 0.75pt;\">\n<p style=\"text-align: center;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">1<\/span><\/p>\n<\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.75pt; border-right: solid 0.75pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\ud638\uc2a4\ud2b8 \ubcc0\uc218\uac00 \uc5c6\uace0, \uc9c8\uc758\uac00 \uc5c6\ub294 \uac83<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.75pt; border-bottom: solid 0.75pt; border-right: solid 0.75pt;\">\n<p style=\"text-align: center;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">2<\/span><\/p>\n<\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.75pt; border-right: solid 0.75pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uac2f\uc218\ub97c \uc54c\uace0, \uc9c8\uc758\uac00 \uc5c6\ub294 \uac83<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.75pt; border-bottom: solid 0.75pt; border-right: solid 0.75pt;\">\n<p style=\"text-align: center;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">3<\/span><\/p>\n<\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.75pt; border-right: solid 0.75pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">select-list item\uacfc \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uac2f\uc218\ub97c \uc54c\uace0, \uc9c8\uc758\uac00 \uc788\ub294 \uac83<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.75pt; border-bottom: solid 0.75pt; border-right: solid 0.75pt;\">\n<p style=\"text-align: center;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">4<\/span><\/p>\n<\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.75pt; border-right: solid 0.75pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">select-list item \ub610\ub294 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uac2f\uc218\uac00 \uc815\ud574\uc838 \uc788\uc9c0 \uc54a\uace0, \uc9c8\uc758\uac00 \uc788\ub294 \uac83<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<ul>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\ucc38\uace0: select-list item\uc740 \uceec\ub7fc\uba85\uacfc \ud45c\ud604\uc744 \ud3ec\ud568\ud55c\ub2e4. (\uc608: SAL*1.10, MAX(SAL))<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h2><\/h2>\n<h2><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc95 1<br \/>\n<\/span><\/h2>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc774 \uae30\ubc95\uc740 \ud504\ub85c\uadf8\ub7a8\uc73c\ub85c \ud558\uc5ec\uae08 \ub3d9\uc801 SQL\ubb38\uc744 \ubc1b\uc544\ub4e4\uc774\uac70\ub098 \uad6c\ucd95\ud558\uace0, EXECUTE IMMEDIATE \uba85\ub839\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc989\uac01 \uc2e4\ud589\ud558\ub294 \ubc29\ubc95\uc774\ub2e4. SQL \ubb38\uc7a5\uc740 SELECT \ubb38 \uac19\uc740 \uc9c8\uc758\uac00 \uc544\ub2c8\uc5b4\uc57c \ud558\uba70, \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc5d0 \ub300\ud574 placeholder\ub97c \uac00\uc838\uc11c\ub3c4 \uc548\ub41c\ub2e4. \uc774\ud558\uc758 \ud638\uc2a4\ud2b8 \ubb38\uc790\uc5f4\uc740 \uc774 \uc870\uac74\uc744 \ub9cc\uc871\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;DELETE FROM EMP WHERE DEPTNO = 20&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;GRANT SELECT ON EMP TO scott&#8217; (scott \uc0ac\uc6a9\uc790\uc5d0\uac8c SELECT \uad8c\ud55c \ubd80\uc5ec)<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc951\uc740 \uc2e4\ud589\ub420 \ub54c \ub9c8\ub2e4 SQL \ubb38\uc774 parse \ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h2><\/h2>\n<h2><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc95 2<br \/>\n<\/span><\/h2>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc774 \uae30\ubc95\uc740 \ud504\ub85c\uadf8\ub7a8\uc73c\ub85c \ud558\uc5ec\uae08 \ub3d9\uc801 SQL \ubb38\uc744 \ubc1b\uc544\ub4e4\uc774\uac70\ub098 \uad6c\ucd95\ud558\uace0, PREPARE\uc640 EXECUTE \uba85\ub839\uc744 \uc0ac\uc6a9\ud558\uc5ec \ucc98\ub9ac\ud55c\ub2e4. SQL \ubb38\uc7a5\uc740 \uc9c8\uc758\uac00 \uc544\ub2c8\uc5b4\uc57c \ud55c\ub2e4. \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc5d0 \ub300\ud55cplaceholder\uc758 \uac1c\uc218\uc640 \ub370\uc774\ud0c0 \ud0c0\uc785\uc740 \ucef4\ud30c\uc77c \uc774\uc804\uc5d0 \uc54c \uc218 \uc788\uc5b4\uc57c \ud55c\ub2e4. \uc608\ub97c \ub4e4\uc5b4 \ub2e4\uc74c \ud638\uc2a4\ud2b8 \ubb38\uc790\uc5f4\uc740 \uc774 \uc870\uac74\uc744 \ucda9\uc871\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;INSERT INTO EMP (ENAME, JOB) VALUES (:emp_name, :job_title)&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;DELETE FROM EMP WHERE EMPNO = :emp_number&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc952\ub85c\uc368, SQL \ubb38\uc7a5\uc740 \uc624\uc9c1 \ud55c\ubc88 parse\ub418\uc9c0\ub9cc, \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uac12\uc5d0 \ub530\ub77c \uc5ec\ub7ec\ubc88 \uc2e4\ud589\ub420 \uc218 \uc788\ub2e4. CREATE\uc640 GRANT \ub4f1\uc758 SQL \ub370\uc774\ud0c0 \uc815\uc758 \ubb38\uc7a5\uc740 PREPARE\ub418\uc5c8\uc744 \ub54c \uc2e4\ud589\ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h2><\/h2>\n<h2><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc953<br \/>\n<\/span><\/h2>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc774 \uae30\ubc95\uc740 \ud504\ub85c\uadf8\ub7a8\uc73c\ub85c \ud558\uc5ec\uae08 \ub3d9\uc801 \uc9c8\uc758\ub97c \uad6c\ucd95\ud558\uac70\ub098 \uc218\uc6a9\ud558\uac8c \ud558\uace0, DECLARE, OPEN, FETCH, CLOSE \ub4f1\uc758 cursor \uba85\ub839\uacfc \ud568\uaed8 PREPARE\ubb38\uc744 \uc0ac\uc6a9\ud568\uc73c\ub85c\uc368 \uadf8 \uc9c8\uc758\ub97c \ucc98\ub9ac\ud55c\ub2e4. Select-list\uc758 \ud56d\ubaa9 \uc218, \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc5d0 \ub300\ud55c placeholder\uc758 \uac1c\uc218\uc640 \ub370\uc774\ud0c0 \ud0c0\uc785\uc740 precompile \uc2dc\uae30\uc5d0 \uc54c \uc218 \uc788\uc5b4\uc57c \ud55c\ub2e4. \uc608\ub97c \ub4e4\uba74 \ub2e4\uc74c\uc758 \ud638\uc2a4\ud2b8 \ubb38\uc790\uc5f4\uc740 \uc774\ub7ec\ud55c \uc870\uac74\uc744 \ucda9\uc871\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;SELECT DEPTNO, MIN(SAL), MAX(SAL) FROM EMP GROUP BY DEPTNO&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;SELECT ENAME, EMPNO FROM EMP WHERE DEPTNO = :dept_number&#8217;<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h2><\/h2>\n<h2><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc954<br \/>\n<\/span><\/h2>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc774 \uae30\ubc95\uc740 \ud504\ub85c\uadf8\ub7a8\uc73c\ub85c \ud558\uc5ec\uae08 \ub3d9\uc801 \uc9c8\uc758\ub97c \uad6c\ucd95\ud558\uac70\ub098 \uc218\uc6a9\ud558\uace0 \ub098\uc11c, descriptor\ub97c \uc0ac\uc6a9\ud558\uc5ec \ucc98\ub9ac\ud55c\ub2e4. Select list\uc758 \ud56d\ubaa9 \uc218, \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc5d0 \ub300\ud55c placeholder\uc758 \uac1c\uc218\uc640 \ub370\uc774\ud0c0 \ud0c0\uc785\uc740 run time \uc774\uc804\uae4c\uc9c0 \ubaa8\ub97c \uc218\ub3c4 \uc788\ub2e4. \uc608\ub97c \ub4e4\uc5b4 \ub2e4\uc74c\uc758 \ud638\uc2a4\ud2b8 \ubb38\uc790\uc5f4\uc740 \uc774\ub7ec\ud55c \uc870\uac74\uc5d0 \ub9de\ub294\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;INSERT INTO EMP (&lt;unknown&gt;) VALUES (&lt;unknown&gt;)&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;SELECT &lt;unknown&gt; FROM EMP WHERE DEPTNO = 20&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc95 4\ub294 \uba87\uac1c\uc778\uc9c0 \uc54c \uc218 \uc5c6\ub294 select-list\uc758 \ud56d\ubaa9 \uc218\uc640 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub97c \ud3ec\ud568\ud55c \ub3d9\uc801 SQL\ubb38\uc744 \uc704\ud574 \uc694\uad6c\ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h2><\/h2>\n<h2><span style=\"font-family: HY\uc911\uace0\ub515;\">\uac00\uc774\ub4dc\ub77c\uc778<br \/>\n<\/span><\/h2>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub124 \uac00\uc9c0 \ubaa8\ub4e0 \uae30\ubc95\ub4e4\uc5d0 \uc788\uc5b4\uc11c \ub3d9\uc801 SQL\ubb38\uc740 \ubb38\uc790\uc5f4\ub85c \uc800\uc7a5\ub418\uc5b4\uc57c \ud558\uba70, \uadf8\uac83\uc740 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc774\uac70\ub098 &#8221;\ub85c \uc2f8\uc778 \ubb38\uc790\ub4e4\uc774\ub2e4. SQL \ubb38\uc744 \ubb38\uc790\uc5f4\ub85c \uc800\uc7a5\ud560 \ub54c EXEC SQL \ud0a4\uc6cc\ub4dc\uc640 &#8216;;&#8217;\ub97c \uc81c\uac70\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc95 2\uc640 3\uc5d0 \uc788\uc5b4\uc11c, \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc5d0 \ub300\ud55c placeholder\uc758 \uac1c\uc218\uc640 \ub370\uc774\ud0c0 \ud0c0\uc785\uc740 precompile \uc2dc\uc5d0 \uc54c\ub824\uc838\uc57c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc5f4\uac70\ub41c \uac01 \uae30\ubc95\uc740 1\uc5d0\uc11c 4\ub85c \uac08\uc218\ub85d \uc810\uc810 \uc801\uc740 \uc81c\ud55c\uc744 \uc8fc\uc9c0\ub9cc, \ucf54\ub529\ud558\uae30\uc5d4 \ub354 \uc5b4\ub824\uc5b4\uc9c4\ub2e4. \ub420 \uc218 \uc788\ub294\ud55c \uac00\uc7a5 \ub2e8\uc21c\ud55c \uae30\ubc95\uc744 \uc0ac\uc6a9\ub3c4\ub85d \ud558\ub77c. \uadf8\ub7ec\ub098, \uae30\ubc95 1\uc744 \uc0ac\uc6a9\ud558\uc5ec \ub3d9\uc801SQL \ubb38\uc774 \ubc18\ubcf5\uc801\uc73c\ub85c \uc2e4\ud589\ub41c\ub2e4\uba74, \uac01 \uc2e4\ud589\uc5d0 \ub300\ud574 reparse\ub428\uc744 \ubc29\uc9c0\ud558\uae30 \uc704\ud574\uc11c \uae30\ubc95 2\ub97c \uc0ac\uc6a9\ud558\ub77c.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc95 4\ub294 \ucd5c\uace0\uc758 \uc720\uc5f0\uc131\uc744 \uac16\uc9c0\ub9cc, \ubcf5\uc7a1\ud55c \ucf54\ub529\uacfc \ub3d9\uc801 SQL \uac1c\ub150\uc758 \uc644\ubcbd\ud55c \uc774\ud574\ub97c \uc694\uad6c\ud55c\ub2e4. \uc77c\ubc18\uc801\uc73c\ub85c, \uae30\ubc951,2,3\uc744 \ubaa8\ub450 \uc0ac\uc6a9\ud558\uc9c0 \ubabb\ud560 \uacbd\uc6b0 \uc0ac\uc6a9\ud55c\ub2e4. \ub2e4\uc74c \uadf8\ub9bc\uc740 \uc801\uc808\ud55c \uae30\ubc95\uc744 \uc120\ud0dd\ud558\ub294 \ub370 \ub3c4\uc6c0\uc744 \uc904 \uac83\uc774\ub2e4.<br \/>\n<\/span><\/p>\n<p style=\"text-align: center;\"><img src=\"https:\/\/i0.wp.com\/oracledba.zapto.org\/wordpress\/wp-content\/uploads\/2018\/03\/031918_0120_DynamicSQL1.png?w=640\" alt=\"\" data-recalc-dims=\"1\" \/><span style=\"font-family: HY\uc911\uace0\ub515;\"><br \/>\n<\/span><\/p>\n<h2><\/h2>\n<h2><span style=\"font-family: HY\uc911\uace0\ub515;\">\uacf5\ud1b5 \uc5d0\ub7ec \ud53c\ud558\uae30<br \/>\n<\/span><\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">Command line option = V6 \/ DBMS = V6_CHAR \uc77c \uacbd\uc6b0&#8230;<br \/>\n<\/span><\/div>\n<\/li>\n<\/ul>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub2e4\ub978 SQL \ubb38\uc5d0 \ub300\ud574 \ubc30\uc5f4\uc744 \uc7ac\uc0ac\uc6a9\ud560 \ub54c \ucd08\uae30\ud654\ub97c \uc2dc\ucf1c\uc8fc\ub294 \uac83\uc740 \ub9e4\uc6b0 \uc911\uc694\ud558\ub2e4. \ud56d\uc0c1 SQL \ubb38\uc7a5\uc744 \uc800\uc7a5\ud558\uae30 \uc774\uc804\uc5d0 \ud638\uc2a4\ud2b8 \ubb38\uc790\uc5f4\uc744 \ucd08\uae30\ud654 \ub610\ub294 \uc7ac\ucd08\uae30\ud654\ud558\ub294 \uac83\uc744 \uaddc\uce59\ud654\ud558\uc5ec\uc57c \ud55c\ub2e4. \ud638\uc2a4\ud2b8 \ubb38\uc790\uc5f4\uc744 null\ub85c \ub05d\ub098\uac8c \ud558\uc9c0 \uc54a\uc544\uc57c \ud55c\ub2e4. Oracle\uc740 null \uc885\uacb0\uac12\uc744 end-of-string sentinel\ub85c \uc778\uc2dd\ud558\uc9c0 \ubabb\ud55c\ub2e4. \ub300\uc2e0 \uadf8\uac83\uc744 SQL \ubb38\uc758 \uc77c\ubd80\ub85c \ub2e4\ub8ec\ub2e4.<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>\n<div style=\"text-align: justify;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">Command line option = V7 \uc77c \uacbd\uc6b0&#8230;<br \/>\n<\/span><\/div>\n<\/li>\n<\/ul>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">PREPARE \ub610\ub294 EXECUTE IMMEDIATE \uba85\ub839\uc744 \uc2e4\ud589\ud558\uae30 \uc774\uc804\uc5d0 \ubb38\uc790\uc5f4\uc774 null\ub85c \ub05d\ub098\ub294\uc9c0\ub97c \ud655\uc778\ud574\uc57c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">DBMS\uc5d0 \ubb34\uad00\ud558\uac8c, VARCHAR \ubcc0\uc218\ub97c \ub3d9\uc801 SQL \ubb38\uc7a5\uc744 \uc800\uc7a5\ud558\ub294 \ub370\uc5d0 \uc0ac\uc6a9\ud55c\ub2e4\uba74, PREPARE \ub610\ub294 EXECUTE IMMEDIATE \uba85\ub839\uc744 \uc2e4\ud589\ud558\uae30 \uc774\uc804\uc5d0 VARCHAR\uc758 \uae38\uc774\uac00 \uc81c\ub300\ub85c \uc124\uc815\ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud574\uc57c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h2><\/h2>\n<h2><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc951\uc758 \uc0ac\uc6a9<br \/>\n<\/span><\/h2>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uac00\uc7a5 \ub2e8\uc21c\ud55c \ub3d9\uc801 SQL \ubb38\uc7a5\uc758 \uacb0\uacfc\ub294 &#8216;\uc131\uacf5&#8217; \ub610\ub294 &#8216;\uc2e4\ud328&#8217;\ub85c \ub098\ud0c0\ub098\uba70, \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub97c \uc0ac\uc6a9\ud558\uc9c0 \uc54a\ub294\ub2e4. \uba87 \uac00\uc9c0 \uc608\ub97c \ub4e4\uc5b4\ubcf8\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;DELETE FROM table_name WHERE column_name = constant&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;CREATE TABLE table_name &#8230;&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;DROP INDEX index_name&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;UPDATE table_name SET column_name = constant&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;GRANT SELECT ON table_name TO username&#8217;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">&#8216;REVOKE RESOURCE FROM username&#8217; (\uc0ac\uc6a9\uc790\ub85c\ubd80\ud130 \uc804\uccb4 \uad8c\ud55c \ucde8\uc18c)<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc95 1\uc740 parse\ud558\uace0 EXECUTE IMMEDIATE \uba85\ub839\uc744 \uc0ac\uc6a9\ud558\uc5ec SQL\ubb38\uc744 \uc989\uac01 \uc2e4\ud589\ud55c\ub2e4. \uba85\ub839 \ub2e4\uc74c\uc73c\ub85c \uc9c8\uc758\uac00 \uc544\ub2cc, \uc2e4\ud589\ub420 SQL\ubb38\uc774 \ub2f4\uae34 \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub098 literal \ub4f1\uc758 \ubb38\uc790\uc5f4\uc774 \ub530\ub978\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXECUTE IMMEDIATE \ubb38\uc758 \ubb38\ubc95 \uaddc\uce59\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515; font-size: 10pt;\"><strong>EXECUTE SQL EXECUTE IMMEDIATE { :host_string | string_literal };<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub2e4\uc74c\uc5d0 \ub098\uc624\ub294 \uc608\uc5d0\uc11c \ud638\uc2a4\ud2b8 \ubcc0\uc218 sql_stmt\ub294 \uc0ac\uc6a9\uc790\ub85c\ubd80\ud130 \uc785\ub825\ub41c SQL \ubb38\uc744 \uc800\uc7a5\ud558\ub294 \ub370\uc5d0 \uc0ac\uc6a9\ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">char sql_stmt[132];<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">. . .<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">for ( ; \ud83d\ude09<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">{<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8220;Enter SQL statements: &#8220;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0gets(sql_stmt);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0if (*sql_stmt == &#8216;\\0&#8217;)<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0break;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\/* sql_stmt\ub294 \uc774\uc81c SQL \ubb38\uc7a5\uc744 \uac16\uac8c \ub41c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL EXECUTE IMMEDIATE :sql_stmt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub610\ud55c \uc544\ub798 \uc608\ucc98\ub7fc \ubb38\uc790\uc5f4\uc744 \uc9c1\uc811 \uc0ac\uc6a9\ud560 \uc218\ub3c4 \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXEC SQL EXECUTE IMMEDIATE &#8216;REVOKE RESOURCE FROM MILLER&#8217;;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXECUTE IMMEDIATE\ub294 \ub9e4 \uc2e4\ud589 \uc774\uc804\uc5d0 \uc785\ub825 SQL\ubb38\uc744 parse \uc2dc\ud0a4\ubbc0\ub85c, \uae30\ubc95 1\uc740 \uc624\uc9c1 \ud55c\ubc88 \uc2e4\ud589\ub418\ub294 \ubb38\uc7a5\uc5d0 \ub300\ud574 \ucd5c\uace0\uc758 \ud6a8\uacfc\ub97c \uac16\ub294\ub2e4. DDL\uc774 \uc8fc\ub85c \uc774 \uc601\uc5ed\uc5d0 \uc18d\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h3><\/h3>\n<h3><\/h3>\n<h3><span style=\"font-family: HY\uc911\uace0\ub515;\">Sample Program<br \/>\n<\/span><\/h3>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub2e4\uc74c\uc5d0 \ub098\uc624\ub294 \ud504\ub85c\uadf8\ub7a8\uc740 \ud14c\uc774\ube14\uc744 \uc0dd\uc131, \ud589 \uc0bd\uc785, \uc0bd\uc785 commit, \ud14c\uc774\ube14 \uc0ad\uc81c \ub4f1\uc758 \ub0b4\uc6a9\uc73c\ub85c \uae30\ubc951\uc744 \uc0ac\uc6a9\ud55c \uac83\uc774\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#include &lt;stdio.h&gt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#include &lt;string.h&gt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#include &lt;oraca.h&gt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXEC ORACLE OPTION (ORACA = YES)<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* RELEASE_CURSOR=YES \uc635\uc158\uc744 \uc124\uc815\ud568\uc73c\ub85c\uc368 embedded SQL\uc774 \uc2e4\ud589\ub418\uace0<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \ub098\uba74 \uadf8\ub4e4\uacfc \uacb0\ud569\ub418\uc5b4 \uc788\ub358 \uc790\uc6d0\uc744 \ud574\uc81c\ud560 \uc218 \uc788\uac8c \ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXEC ORACLE OPTION (RELEASE_CURSOR = YES)<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">void sql_error();<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">main();<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">{<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0char \u00a0\u00a0\u00a0\u00a0*username = &#8220;SCOTT&#8221;;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0char\u00a0\u00a0\u00a0\u00a0*password = &#8220;TIGER&#8221;;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0char\u00a0\u00a0\u00a0\u00a0*sqlstmt1;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0char\u00a0\u00a0\u00a0\u00a0sqlstmt2[10];<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0VARCHAR\u00a0\u00a0\u00a0\u00a0sqlstmt3[80];<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL WHENEVER SQLERROR DO sql_error(&#8220;Oracle error:&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0oraca.orastxtf = ORASTFERR;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL CONNECT :username IDENTIFIED BY :password;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0puts(&#8220;\\nConnected to ORACLE.\\n&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \ud14c\uc774\ube14\uc744 \uc0dd\uc131\ud558\ub294 \ubb38\uc790\uc5f4\uc744 \uc2e4\ud589\ud55c\ub2e4. \uc0ac\uc2e4 \uc774\uac83\uc740 \uc2e4\ud589 \uc2dc\uac04\uc5d0 SQL \ubb38\uc7a5\uc744<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uacb0\uc815\ud558\ub294 \uac83\uc774 \uc544\ub2c8\ubbc0\ub85c \ub3d9\uc801\uc774\uc9c0 \ubabb\ud558\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0puts(&#8220;CREATE TABLE dyn1 (col1 VARCHAR2(4))&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL EXECUTE IMMEDIATE<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;CREATE TABLE dyn1 (col1 VARCHAR2(4))&#8221;;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \ud589\uc744 \uc0bd\uc785\ud558\ub294 \ubb38\uc790\uc5f4\uc744 \uc2e4\ud589\ud55c\ub2e4. \ubc30\uc5f4\uc758 \uc0ac\uc6a9\ub418\uc9c0 \uc54a\ub294 \ub098\uba38\uc9c0 \ubd80\ubd84\uc740 \uacf5\ubc31\uc73c\ub85c<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \ucc44\uc6b0\uace0, \ubb38\uc790\uc5f4\uc740 null\ub85c \ub05d\ub098\uc9c0 \uc54a\uc544\uc57c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0strncpy(sqlstmt2, &#8220;COMMIT &#8220;, 10);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8220;%.10s\\n&#8221;, sqlstmt2);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL EXECUTE IMMEDIATE :sqlstmt2;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"><br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \ud14c\uc774\ube14\uc744 drop\ud558\uae30 \uc704\ud574 VARCHAR\ub97c \uc2e4\ud589\ud558\ub77c. &#8216;.len&#8217; \ud544\ub4dc\uac12\uc744 &#8216;.arr&#8217; \ud544\ub4dc\uc758<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uae38\uc774\ub85c \uc124\uc815\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0strcpy(sqlstmt3.arr, &#8220;DROP TABLE DYN1&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0sqlstmt3.len = strlen(sqlstmt3.arr);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0puts((char *) sqlstmt3.arr);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL EXECUTE IMMEDIATE :sqlstmt3;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \ubbf8\uacb0\uc815\ub41c \ubcc0\ud654\ub97c commit\ud558\uace0 Oracle \uc811\uc18d\uc744 \ub04a\ub294\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL EXECUTE IMMEDIATE :sqlstmt3;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0puts(&#8220;\\nHave a good day!\\n&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"><br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0return 0;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"><br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">void sql_error()<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">{<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \uc774 \ud504\ub85c\uadf8\ub7a8\uc740 oracle error handler\ub85c\uc11c, \uc5d0\ub7ec \uba54\uc2dc\uc9c0, \ud604\uc7ac SQL\ubb38\uc7a5, error\uc758<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uc704\uce58 \ub4f1 \uc9c4\ub2e8 \ubb38\uad6c\ub97c \ucd9c\ub825\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8220;%s\\n&#8221;, msg);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8220;\\n%.*s\\n&#8221;, sqlca.sqlerrm.sqlerrml, sqlca.sqlerrm.sqlerrmc);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8220;in \\&#8221;%.*s. . .\\&#8221;\\n&#8221;, oraca.orastxt.orastxt1, oraca.oraca.orastxt.orastxtc);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8220;on line %d of %.*s.\\n\\n&#8221;,<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0oraca.oraslnr, orasfnm.orasfnml,<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0oraca.orasfnm.orasfnmc);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \uc774 \ub8e8\ud2f4\ub0b4\uc5d0\uc11c \ubb34\ud55c \ub8e8\ud504\ub97c \ub3cc\ub2e4\uac00 \ub610 \ub2e4\ub978 \uc5d0\ub7ec\ub97c \uc720\ubc1c\ud558\ub294 \uac83\uc744 \ubc29\uc9c0\ud558\uae30 \uc704\ud574<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * ORACLE error checking\uc744 \ubb34\ub825\ud558\uac8c \ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SL WHENEVER SQLERROR CONTINUE;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \ubbf8\uacb0\uc815\ub41c \ubcc0\ud654\ub97c rollback\uc2dc\ud0a4\uace0 Oracle \uc811\uc18d\uc744 \ub04a\ub294\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL ROLLBACK RELEASE;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0exit(1);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">}<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h2><\/h2>\n<h2><\/h2>\n<h2><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc952\uc758 \uc0ac\uc6a9<br \/>\n<\/span><\/h2>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc951\uc774 1\uc2a4\ud15d\uc774\uba74, \uae30\ubc952\ub294 2\uc2a4\ud15d\uc774\ub2e4. \uc9c8\uc758 \ud615\ud0dc\uac00 \uc544\ub2d0 \uc218\ub3c4 \uc788\ub294 \ub3d9\uc801 SQL \ubb38\uc7a5\uc740 \uba3c\uc800 PREPARE(\uba85\uba85\ub418\uace0 parse\ub428)\ub418\uace0 \ub098\uc11c EXECUTE\ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc952\uc5d0\uc11c\ub294 SQL \ubb38\uc7a5\uc774 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc640 indicator \ubcc0\uc218\uc5d0 \ub300\ud574 placeholder\ub97c \uac00\uc9c8 \uc218 \uc788\ub2e4. \uc77c\ub2e8 SQL \ubb38\uc744 PREPARE\ud558\uace0 \ub098\uba74, \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uc5ec\ub7ec \uac12\ub4e4\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubc18\ubcf5\uc801\uc73c\ub85c EXECUTE \uc2dc\ud0a8\ub2e4. \uac8c\ub2e4\uac00, COMMIT\uc774\ub098 ROLLBACK \uc774\ud6c4 SQL\ubb38\uc744 \ub2e4\uc2dc PREPARE\ud560 \ud544\uc694\uac00 \uc5c6\ub2e4. (log off\ud558\uace0 reconnect \ud558\uc9c0 \uc54a\ub294 \ud55c)<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">PREPARE \ubb38\uc758 \ubb38\ubc95\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515; font-size: 10pt;\"><strong>EXEC SQL PREPARE statement_name<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515; font-size: 10pt;\"><strong>\u00a0\u00a0\u00a0\u00a0FROM { :host_string | string_literal };<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">PREPARE\ub294 SQL \ubb38\uc744 parse\ud574\uc8fc\uace0 \uc774\ub984\uc744 \uc900\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"><em>statement_name<\/em>\uc740 precompiler\uc5d0 \uc758\ud574 \uc0ac\uc6a9\ub418\ub294 \uc2dd\ubcc4\uc790\ub85c\uc11c, \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub098 \ud504\ub85c\uadf8\ub7a8 \ubcc0\uc218\uac00 \uc544\ub2c8\uace0, \uc120\uc5b8\ubd80(Declare Section) \ub0b4\uc5d0 \uc120\uc5b8\ub418\uc5b4\uc11c\ub294 \uc548\ub41c\ub2e4. \uadf8\uac83\uc740 \ub2e8\uc9c0 \uc2e4\ud589\uc2dc\ud0a4\uace0 \uc2f6\uc740 PREPARE\ub41c \ubb38\uc7a5\uc744 \uc758\ubbf8\ud560 \ubfd0\uc774\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXECUTE\ubb38\uc758 \ubb38\ubc95\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515; font-size: 10pt;\"><strong>EXEC SQL EXECUTE statement_name [USING <em>host_variable_list<\/em>];<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub610 <em>host_variable_list<\/em>\ub294 \ub2e4\uc74c \ubb38\ubc95\uc744 \ub530\ub978\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515; font-size: 10pt;\"><strong>:host_variable1[:indicator1] [, host_variable2 [:indicator2], &#8230;]<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXECUTE\ub294 \uac01\uac01\uc758 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub97c \uac00\uc9c0\uace0 parse\ub41c SQL \ubb38\uc7a5\uc744 \uc2e4\ud589\uc2dc\ud0a8\ub2e4. \ub2e4\uc74c\uc5d0 \ub098\uc624\ub294 \uc608\uc5d0\uc11c \uc785\ub825 SQL \ubb38\uc7a5\uc740 placeholder <em>n<\/em>\uc744 \uac00\uc9c0\uace0 \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">. . .<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">int emp_number INTEGER;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">char delete_stmt[120], search_cond[40];<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">. . .<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">strcpy(delete_stmt, &#8220;DELETE FROM EMP WHERE EMPNO = :n AND &#8220;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">printf(&#8220;Complete the following statement&#8217;s search condition&#8211;\\n&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">printf(&#8220;%s\\n&#8221;, delete_stmt);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">gets(search_cond);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">strcat(delete_stmt, search_cond);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXEC SQL PREPARE sql_stmt FROM :delete_stmt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">for( ; \ud83d\ude09<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">{<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 11pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">printf(&#8220;Enter employee number: &#8220;);<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 11pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0gets(temp);<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 11pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0emp_number = atoi(temp);<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 11pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0if (emp_number == 0)<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 11pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0break;<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 11pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL EXECUTE sql_stmt USING :emp_number;<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 11pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">}<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 11pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">\uae30\ubc952\uc5d0\uc11c\ub294 precompile \uc2dc\uc5d0 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \ub370\uc774\ud0c0 \ud0c0\uc785\uc744 \uc54c\uace0 \uc788\uc5b4\uc57c \ud55c\ub2e4. \uc704 \uc608\uc5d0\uc11c emp_number\ub294 int\ub85c \uc120\uc5b8\ub418\uc5c8\ub2e4. \uc774\ub294 float, char\ub85c \uc120\uc5b8\ub420 \uc218\ub3c4 \uc788\ub2e4. Oracle\uc740 \uc774\ub7f0 \ubaa8\ub4e0 \ub370\uc774\ud0c0 \ud0c0\uc785\uc744 \ub0b4\ubd80\uc758 Oracle NUMBER \ud0c0\uc785\uc73c\ub85c \uc804\ud658\ud560 \uc218 \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h3><\/h3>\n<h3><span style=\"font-family: HY\uc911\uace0\ub515;\">USING \uc808<br \/>\n<\/span><\/h3>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">SQL \ubb38\uc774 EXECUTE \ub420 \ub54c, USING\uc808\uc5d0 \uc788\ub294 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub4e4\uc740 PREPARE \ub3d9\uc801 SQL \ubb38\uc5d0 \uc788\ub294 placeholder\uc640 \ub300\uce58\ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uac01 PREPARE \ub3d9\uc801 SQL\ubb38\uc758 placeholder\ub294 USING\uc808\uc758 \uc11c\ub85c \ub2e4\ub978 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc640 \ub300\uc751\ub418\uc5b4\uc57c \ud55c\ub2e4. \uadf8\ub798\uc11c, \ub9cc\uc57d \uac19\uc740 placeholder\uac00 PREPARE\ubb38\uc5d0 \uc5ec\ub7ec\ubc88 \ub098\ud0c0\ub09c\ub2e4\uba74, USING \uc808\uc5d0\uc11c\ub3c4 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uac00 \ub300\uc751\ub418\uc5b4 \ub098\ud0c0\ub098\uc57c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">Placeholder\uc758 \uc774\ub984\uc740 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uc774\ub984\uacfc \ub300\ub4f1\ud560 \ud544\uc694\uac00 \uc5c6\ub2e4. \ud558\uc9c0\ub9cc, PREPARE \ub3d9\uc801 SQL\ubb38\uc758 placeholder\uc758 \uc21c\uc11c\uc640 USING\uc808\uc758 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc758 \uc21c\uc11c\ub294 \ub300\ub4f1\ud558\uc5ec\uc57c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\ub9cc\uc57d, USING\uc808\uc758 \ud638\uc2a4\ud2b8 \ubcc0\uc218 \uc911 \ud558\ub098\uac00 \ubc30\uc5f4\uc774\ub77c\uba74, \ubaa8\ub450 \ubc30\uc5f4\uc774\uc5b4\uc57c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">Null \uac12\uc778\uc9c0 \uba85\ud655\ud788 \ud558\uae30 \uc704\ud574\uc11c, USING\uc808\uc758 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uc640 indicator \ubcc0\uc218\ub97c \uacb0\ud569\ud560 \uc218 \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<div style=\"text-align: justify;\">\n<h3><\/h3>\n<h3><span style=\"font-family: HY\uc911\uace0\ub515;\">Sample Program<br \/>\n<\/span><\/h3>\n<\/div>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\uc5ec\uae30 \uc788\ub294 \ud504\ub85c\uadf8\ub7a8\uc740 \ub3d9\uc801 SQL \uae30\ubc95 2\ub97c \uc0ac\uc6a9\ud558\uc5ec EMP \ud14c\uc774\ube14\uc5d0 \ub450\uac1c\uc758 \ud589\uc744 \uc0bd\uc785\ud558\uace0 \uc0ad\uc81c\ud55c\ub2e4. \ud30c\uc77c <em>sample7.pc<\/em>, demo \ub514\ub809\ud1a0\ub9ac, on-line\uc73c\ub85c \uc0ac\uc6a9 \uac00\ub2a5\ud558\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/*<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * sample 7.pc : Dynamic SQL Method 2<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">.*\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#include &lt;stdio.h&gt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#include &lt;string.h&gt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#define USERNAME &#8220;SCOTT&#8221;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#define PASSWORD &#8220;TIGER&#8221;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* ORACLE\uc774 \uc5d0\ub7ec \ucf54\ub4dc, \uacbd\uace0 \ud50c\ub798\uadf8, \uc9c4\ub2e8 \ubb38\uad6c \ub4f1\uc758 \uc2e4\ud589\uc2dc\uac04 \uc0c1\ud0dc \uc815\ubcf4\ub97c \ub9cc\ub4e4\uc5b4<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uc8fc\uae30 \uc704\ud574 \ud544\uc694\ud55c SQL Communication Area\ub97c Include \ud574\uc900\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#include &lt;sqlca.h&gt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* ORACLE\uc774 \ucd94\uac00\uc801\uc778 \uc2e4\ud589\uc2dc\uac04 \uc0c1\ud0dc \uc815\ubcf4\ub97c \ub9cc\ub4e4\uc5b4 \uc8fc\uae30 \uc704\ud574 \ud544\uc694\ud55c ORACLE<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * Communication Area\ub97c include \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">#include &lt;oraca.h&gt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* ORACA=YES \uc635\uc158\uc740 ORACA\uc758 \uc0ac\uc6a9\uc744 \uac00\ub2a5\ud558\uac8c \ud558\uae30 \uc704\ud574\uc11c \ud544\uc694\ud558\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">EXEC ORACLE OPTION (ORACA = YES);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">char\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*username = USENAME;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">char\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0*password = PASSWORD;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">VARCHAR\u00a0\u00a0\u00a0\u00a0sqlstmt[80];<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">int\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0empno = 1234;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">int\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0deptno1 = 97;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">int\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0deptno2 = 99;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* SQL runtime error\ub97c \ucc98\ub9ac\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">void sql_error();<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">main()<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">{<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* embedded SQL\uc744 \ucc98\ub9ac\ud558\ub294 \ub3c4\uc911 \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud558\uba74 sql_error()\uc744 \ud638\ucd9c\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 33pt;\"><span style=\"font-family: HY\uc911\uace0\ub515;\">EXEC SQL WHENEVER SQLERROR DO sql_error(&#8220;Oracle error&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* Error\uac00 \ubc1c\uc0dd\ud558\uba74 ORACA\uc5d0 \uc788\ub294 \ud604\uc7ac\uc758 SQL\ubb38\uc7a5\uc744 \uc800\uc7a5\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0oraca.orastxtf = ORASTFERR;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* Oracle\uc5d0 \uc811\uc18d\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL CONNECT :username IDENTIFIED BY :password;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0puts(&#8220;\\nConnected to Oracle.\\n&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* SQL\ubb38\uc744 VARCHAR sqlstmt\uc5d0 \ud560\ub2f9\ud55c\ub2e4. \ubc30\uc5f4\uacfc \uae38\uc774 \ubd80\ubd84\uc740 \uc81c\ub300\ub85c \uc124\uc815\ub418\uc5b4\uc57c<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \ud55c\ub2e4. \ubb38\uc7a5\uc5d0 \ub450\uac1c\uc758 \ud638\uc2a4\ud2b8 \ubcc0\uc218 placeholder\uc778 v1, v2\uac00 \uc788\uc74c\uc744 \uc8fc\uc2dc\ud558\ub77c. \uc2e4\uc81c<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub294 EXECUTE \uc2dc\uc5d0 \uc81c\uacf5\ub418\uc5b4\uc57c \ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0strcpy(sqlstmt.arr,<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;INSERT INTO EMP (EMPNO, DEPTNO) VALUES (:v1, :v2)&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0sqlstmt.len = strlen(sqlstmt.arr);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* SQL\ubb38\uacfc \ud604\uc7ac\uc758 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218 \uac12\uc744 \ud45c\uc2dc\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0puts((char *) sqlstmt.arr);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8221;\u00a0\u00a0\u00a0\u00a0v1 = %d, v2 = %d\\n&#8221;, empno, deptno1);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* PREPARE\ubb38\uc740 \ubb38\uc7a5 \uc774\ub984\uacfc SQL\ubb38\uc774 \ub4e4\uc5b4\uc788\ub294 \ubb38\uc790\uc5f4\uc744 \uacb0\ud569\uc2dc\ud0a8\ub2e4. \ubb38\uc7a5<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uc774\ub984\uc740 SQL \uc2dd\ubcc4\uc790\uc774\uba70, \ud638\uc2a4\ud2b8 \ubcc0\uc218\uac00 \uc544\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc120\uc5b8\ubd80\uc5d0 \ub098\ud0c0\ub098\uc9c0 \uc54a\ub294\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \ud558\ub098\uc758 \ubb38\uc7a5 \uc774\ub984\uc740 \uc11c\ub85c \ub2e4\ub978 \ubb38\uc790\uc5f4 \ubcc0\uc218\ub97c \uc0ac\uc6a9\ud558\uba74, \ud55c\ubc88 \uc774\uc0c1 PREPARE\ub420 \uc218<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL PREPARE S FROM :sqlstmt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* EXECUTE\ubb38\uc740 PREPARE\ubb38\uc5d0\uc11c \uc0ac\uc6a9\ub41c placeholder\uc758 \uc704\uce58\uc5d0 \ub9de\uac8c \uc785\ub825 \ud638\uc2a4\ud2b8<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \ubcc0\uc218\ub97c \ub300\uce58\ud558\uc5ec \uc2e4\ud589\uc2dc\ud0a8\ub2e4. Placeholder\uac00 \uc5ec\ub7ec \uac1c\ub77c\uba74 USING \uc808\uc5d0\uc11c\ub3c4 \uadf8\uc5d0<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \ub9de\ub294 \ud638\uc2a4\ud2b8 \ubcc0\uc218\uac00 \ub300\uc751\ub418\uc5b4 \uc788\uc5b4\uc57c \ud55c\ub2e4. \ubb38\uc7a5\uc774 placeholder\ub97c \uac00\uc9c0\uace0 \uc788\uc9c0<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uc54a\ub2e4\uba74 USING\uc808\uc740 \ud544\uc694\uc5c6\uac8c \ub41c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \ud55c \uac1c\uc758 PREPARE\ubb38\uc740 USING\uc808\uc758 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub97c \ubc14\uafd4 \uc0ac\uc6a9\ud568\uc73c\ub85c\uc368<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \uc5ec\ub7ec\ubc88 \uc2e4\ud589\ub420 \uc218 \uc788\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL EXECUTE S USING :empno, :deptno1;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* empno\ub97c \uc99d\uac00\uc2dc\ud0a4\uace0 \uc0c8 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218\ub97c \ud45c\uc2dc\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0empno++;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8221;\u00a0\u00a0\u00a0\u00a0v1 = %d, v2 = %d\\n&#8221;, empno, deptno2);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \uc0c8\ub85c\uc6b4 empno\uc640 \ub2e4\ub978 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218 deptno2\ub97c \uc9d1\uc5b4\ub123\uace0 S\ub97c \uc7ac\uc2e4\ud589\ud55c\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> * \ub2e4\uc2dc PREPARE\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc740 \ubd88\ud544\uc694\ud558\ub2e4.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"> *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL S USING :empno, :deptno2;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* sqlstmt\uc5d0 \uc0c8 \uac12\uc744 \ud560\ub2f9\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0strcpy(sqlstmt.arr,<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;DELETE FROM EMP WHERE DEPTNO = :v1 OR DEPTNO = :v2&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0sqlstmt.len = strlen(sqlstmt.arr);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \uc0c8 SQL\ubb38\uacfc \ud604\uc7ac\uc758 \uc785\ub825 \ud638\uc2a4\ud2b8 \ubcc0\uc218 \uac12\uc744 \ud45c\uc2dc\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0puts((char *) sqlstmt.arr);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0printf(&#8221;\u00a0\u00a0\u00a0\u00a0v1 = %d, v2 = %d\\n&#8221;, deptno1, deptno2);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \uc0c8\ub85c\uc6b4 sqlstmt\ub85c \ubd80\ud130 S\ub97c \uc7acPREPARE\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL PEPARE S FROM :sqlstmt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \uc774\uc804\uc5d0 \uc0bd\uc785\ub41c \ub450 \ud589\uc744 \uc0ad\uc81c\ud558\uae30 \uc704\ud574 S\ub97c \uc2e4\ud589\ud55c\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXEC SQL EXECUTE S USING :deptno1, :deptno2;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\/* \ubbf8\uacb0\uc815\ub41c \ubcc0\ud654\ub97c commit\uc2dc\ud0a4\uace0 Oracle \uc811\uc18d\uc744 \ub04a\ub294\ub2e4. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0EXECUTE SQL COMMIT RELEASE;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0puts(&#8220;\\nHave a good day!\\n&#8221;);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0exit(0);<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">void sql_error(char* msg)<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">{<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">\u00a0\u00a0\u00a0\u00a0\/* 6.5.1 Sample Program \uc758 \ub0b4\uc6a9\uc744 \ucc38\uc870. *\/<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\">}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: HY\uc911\uace0\ub515;\"><br \/>\n<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dynamic SQL, \ub3d9\uc801 SQL\uc740 \uc0c1\ud669\uc5d0 \ub530\ub77c \uac00\ubcc0\uc801\uc73c\ub85c \uc0ac\uc6a9\ub418\ub294 SQL\uc744 \uc758\ubbf8\ud55c\ub2e4. Dynamic SQL\uc758 \uae30\ubcf8\uc801 \uac1c\ub150 \ubc0f \uc0ac\uc6a9\ubc95\uc744 \ub2e4\ub8e8\ub3c4\ub85d \ud558\uaca0\ub2e4. &nbsp; Dynamic SQL? \ub300\ubd80\ubd84\uc758 \ub370\uc774\ud0c0\ubca0\uc774\uc2a4 \uc751\uc6a9\ud504\ub85c\uadf8\ub7a8\uc740 \ud2b9\uc815\ud55c \uc77c\uc744 \ud55c\ub2e4. \uc608\ub97c \ub4e4\uba74, \ub2e8\uc21c\ud55c \uac83\uc73c\ub85c \uc0ac\uc6a9\uc790\uc758 \uc0ac\ubc88\uc744 \ubb3b\uace0, EMP\ub098 DEPT \ud14c\uc774\ube14 \ub4f1\uc744 \uac31\uc2e0\ud558\ub294 \uac83\uc774 \uc788\ub2e4. \uc774\ub7f0 \uacbd\uc6b0, \ucef4\ud30c\uc77c \ud558\uae30 \uc804\uc5d0 UPDATE \ubb38\uc744 \uad6c\uc131\ud558\ub294 \uac83\ub4e4\uc744 \uc54c\uace0 \uc788\uac8c \ub41c\ub2e4. \uc989, \uc5b4\ub5a4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3627,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"spay_email":""},"categories":[11],"tags":[1043,1044],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/haisins.synology.me\/wordpress\/wp-content\/uploads\/2018\/03\/sql1.jpg?fit=489%2C345","amp_enabled":true,"_links":{"self":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3624"}],"collection":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3624"}],"version-history":[{"count":2,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3624\/revisions"}],"predecessor-version":[{"id":3626,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3624\/revisions\/3626"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/3627"}],"wp:attachment":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3624"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}