{"id":3092,"date":"2018-05-20T22:37:52","date_gmt":"2018-05-20T13:37:52","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=3092"},"modified":"2023-05-27T21:44:33","modified_gmt":"2023-05-27T12:44:33","slug":"%e3%80%90pl-sql%e3%80%91%e5%a4%89%e6%95%b0%e5%ae%a3%e8%a8%80%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=3092","title":{"rendered":"\u3010PL\/SQL\u3011\u300c\u5909\u6570\u300d\u3084\u300c\u56fa\u5b9a\u5024\u300d\u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"<p>PL\/SQL\u3067\u3082\u300c\u5909\u6570\u300d\u3084\u300c\u56fa\u5b9a\u5024\u300d\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5909\u6570\u3092\u4f7f\u3046\u306b\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u5ba3\u8a00\u90e8\u300d(DECLARE)\u3067\u540d\u524d\u3092\u4ed8\u3051\u308b<\/strong><\/span>\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>\u5909\u6570\u5ba3\u8a00\u306e\u4ed5\u65b9<\/h2>\n<h3>\u6570\u5024\u578b<\/h3>\n<pre class=\"lang:default decode:true\">DECLARE\r\n  num NUMBER;<\/pre>\n<p>\u6570\u5024\u578b\u306b\u306f\u3001\u4ed6\u306b\u3082\u300cBINARY_INTEGER\u300d\u3084\u300cBINARY_FLOAT\u300d\u7b49\u8272\u3005\u3042\u308a\u307e\u3059\u304c\u3001<span style=\"color: #ff0000;\"><strong>\u4e00\u822c\u7684\u306b\u306fNUMBER\u578b\u304c\u4f7f\u7528\u3055\u308c\u308b\u30b1\u30fc\u30b9\u304c\u4e00\u756a\u591a\u3044<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<h3>\u6587\u5b57\u5217\u578b<\/h3>\n<pre class=\"lang:default decode:true\">DECLARE\r\n  str VARCHAR2(5);<\/pre>\n<p>\u4ed6\u306b\u3082\u3001\u300cCHAR\u300d\u3084\u300cLONG\u300d\u7b49\u3082\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u304c\u3001\u304a\u305d\u3089\u304f\u4e00\u756a\u4f7f\u3046\u6a5f\u4f1a\u306e\u591a\u3044\u306e\u306f\u53ef\u5909\u9577\u6587\u5b57\u5217\u578b\u3067\u3042\u308b\u300cVARCHAR2\u300d\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>\u65e5\u4ed8\u578b<\/h3>\n<p>\u4e3b\u306b\u4e0b\u8a18\u4e8c\u3064\u306e\u578b\u304c\u826f\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u30c7\u30fc\u30bf\u578b<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>DATE<\/td>\n<td>\u56fa\u5b9a\u9577\u306e\u65e5\u6642<\/td>\n<\/tr>\n<tr>\n<td>TIMESTAMP<\/td>\n<td>\u5c0f\u6570\u79d2\u3092\u542b\u3080\u65e5\u6642<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ed6\u306b\u306f\u3001\u300cTRUE\u300d\u3084\u300cFALSE\u300d\u3092\u542b\u3080<span style=\"color: #ff0000;\"><strong>\u300c\u30d6\u30fc\u30eb\u578b\u300d<\/strong><\/span>\u306a\u3093\u304b\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u5909\u6570\u3092\u5ba3\u8a00\u3057\u305f\u3060\u3051\u3067\u306f\u3001\u3044\u305a\u308c\u306e\u30c7\u30fc\u30bf\u578b\u3067\u3082\u3001\u307e\u3060<strong>\u5024\u306fNULL\u306e\u72b6\u614b<\/strong>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u5909\u6570\u306e\u547d\u540d\u898f\u5247<\/h2>\n<p>\u4e0b\u8a18\u306e\u30eb\u30fc\u30eb\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u5909\u6570\u540d\u306e1\u6587\u5b57\u76ee\u306f\u3001\u6570\u5024\uff080\uff5e9\uff09\u3001\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2(_)\u3001\u30b7\u30e3\u30fc\u30d7(#)\u304c\u4f7f\u7528\u3067\u304d\u306a\u3044\u304c\u30012\u6587\u5b57\u76ee\u4ee5\u964d\u306a\u3089\u4f7f\u7528\u3067\u304d\u308b\u3002<\/li>\n<li>\u5909\u6570\u540d\u306e\u9577\u3055\u306f30\u6587\u5b57\u307e\u3067<\/li>\n<li>\u5927\u6587\u5b57\u3001\u5c0f\u6587\u5b57\u306f\u533a\u5225\u3057\u306a\u3044\u3002<\/li>\n<li>\u4e88\u7d04\u8a9e\u306f\u4f7f\u7528\u3067\u304d\u306a\u3044\u3002<\/li>\n<\/ul>\n<h3>\u4e88\u7d04\u8a9e\u3068\u306f\uff1f<\/h3>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u3067\u3001\u30ad\u30fc\u30ef\u30fc\u30c9\u3068\u3057\u3066\u65e2\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u8a9e\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u300cDECLARE NUMBER;\u300d\u306a\u3093\u3066\u6307\u5b9a\u3059\u308b\u3068\u3001<span style=\"color: #ff0000;\"><strong>\u300cDECLARE\u300d\u306f\u5ba3\u8a00\u90e8\u3068\u3057\u3066\u4f7f\u308f\u308c\u3066\u3044\u308b\u5358\u8a9e\u306a\u306e\u3067\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/strong><\/span><\/p>\n<h2>\u5909\u6570\u3078\u306e\u4ee3\u5165\u306e\u4ed5\u65b9<\/h2>\n<h3>\u6570\u5024\u306e\u5834\u5408<\/h3>\n<h4>\u666e\u901a\u306b\u4ee3\u5165<\/h4>\n<pre class=\"lang:default decode:true\">DECLARE\r\n  num NUMBER;\r\nBEGIN\r\n  num := 10;\r\nEND;<\/pre>\n<h4>\u6570\u5024\u578b\u304b\u3089\u6570\u5024\u578b\u3078\u4ee3\u5165<\/h4>\n<pre class=\"lang:default decode:true\">DECLARE\r\n  num NUMBER;\r\n  num2 NUMBER;\r\nBEGIN\r\n  num := 10;\r\n  num2 := num * 2;\r\nEND;<\/pre>\n<h3>\u6587\u5b57\u578b\u306e\u5834\u5408<\/h3>\n<h4>\u666e\u901a\u306b\u4ee3\u5165<\/h4>\n<pre class=\"lang:default decode:true\">DECLARE\r\n  str VARCHAR2(15);\r\nBEGIN\r\n  str := '\u3053\u3093\u306b\u3061\u306f';\r\nEND;<\/pre>\n<h4>\u5909\u6570\u306e\u5ba3\u8a00\u3068\u5024\u306e\u4ee3\u5165\u3092\u540c\u6642\u306b\u884c\u3046\u3002<\/h4>\n<p><strong>\u4f8b\uff11\uff1a\u666e\u901a\u306b\u521d\u671f\u5024\u3092\u5165\u308c\u308b\u3002<\/strong><\/p>\n<pre class=\"lang:default decode:true\">DECLARE\r\n  str VARCHAR2(15) := '\u3053\u3093\u306b\u3061\u306f';\r\nBEGIN\r\n\tDBMS_OUTPUT.PUT_LINE(str);\r\nEND;<\/pre>\n<p><strong>\u4f8b\uff12\uff1aDEFAULT\u53e5\u3092\u4f7f\u3046\u3002<\/strong><\/p>\n<pre class=\"lang:default decode:true\">DECLARE\r\n  str VARCHAR2(15) DEFAULT '\u3053\u3093\u306b\u3061\u306f';\r\nBEGIN\r\n\tDBMS_OUTPUT.PUT_LINE(str);\r\nEND;<\/pre>\n<h2>\u5b9a\u6570\u306e\u5ba3\u8a00<\/h2>\n<pre class=\"lang:default decode:true\">DECLARE\r\n  str CONSTANT VARCHAR2(15) DEFAULT '\u3053\u3093\u306b\u3061\u306f';\r\nBEGIN\r\n\tDBMS_OUTPUT.PUT_LINE(str);\r\nEND;<\/pre>\n<p>CONSTANT\u53e5\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u5fc5\u305a\u5b9a\u6570\u306f\u521d\u671f\u5024\u3068\u3057\u3066\u4ee3\u5165\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/strong><\/span>\u3067\u306a\u3051\u308c\u3070\u3001\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9a\u6570\u306f\u76f4\u63a5\u66f8\u304b\u308c\u3066\u3044\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u6bd4\u3079\u3066\u3001\u53ef\u8aad\u6027\u3084\u3001\u4fdd\u5b88\u6027\u3092\u4e0a\u3052\u3066\u304f\u308c\u308b\u306e\u3067\u7a4d\u6975\u7684\u306b\u4f7f\u3046\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"PL\/SQL\u3067\u3082\u300c\u5909\u6570\u300d\u3084\u300c\u56fa\u5b9a\u5024\u300d\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u5909\u6570\u3092\u4f7f\u3046\u306b\u306f\u3001\u300c\u5ba3\u8a00\u90e8\u300d(DECLARE)\u3067\u540d\u524d\u3092\u4ed8\u3051\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 \u5909\u6570\u5ba3\u8a00\u306e\u4ed5\u65b9 \u6570\u5024\u578b DECLARE num NUMBER; \u6570\u5024\u578b\u306b\u306f\u3001\u4ed6\u306b\u3082\u300c [&hellip;]","protected":false},"author":1,"featured_media":3102,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,24],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/3092"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3092"}],"version-history":[{"count":10,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/3092\/revisions"}],"predecessor-version":[{"id":20395,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/3092\/revisions\/20395"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/3102"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3092"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}