{"id":246583,"date":"2022-07-12T10:39:14","date_gmt":"2022-07-12T02:39:14","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=246583"},"modified":"2022-06-29T09:41:38","modified_gmt":"2022-06-29T01:41:38","slug":"oracle-dbms-output","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/oracle-dbms-output.html","title":{"rendered":"\u6559\u4f60\u5982\u4f55\u89e3\u51b3Oracle\u4e2ddbms_output.put_line\u8f93\u51fa\u95ee\u9898"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6700\u8fd1\u7528dbms_output.put_line\u6765\u8f93\u51fa\u53d8\u91cf\u7684\u4e00\u4e9b\u4fe1\u606f,\u5374\u603b\u662f\u770b\u4e0d\u5230\u7ed3\u679c,\u6240\u4ee5\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e86\u5173\u4e8eORACLE\u4e2ddbms_output.put_line\u8f93\u51fa\u95ee\u9898\u7684\u89e3\u51b3\u8fc7\u7a0b,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u524d\u8a00<\/strong><\/div>\n

\u6700\u8fd1\u5199\u4e86oracle\u8fc7\u7a0b\uff0c\u6709\u4e2aORACLE\u4e2ddbms_output.put_line\u8f93\u51fa\u4e0d\u4e86\u7684\u95ee\u9898\u3002 \u82b1\u4e86\u8fd1\u4e00\u4e2a\u5c0f\u65f6\u3002\u4e0b\u9762\u63cf\u8ff0\u4e00\u4e2a\u8fd9\u89e3\u51b3\u95ee\u9898\u7684\u5386\u7a0b\uff08\u67e5\u8d44\u6599\u4e0e\u89e3\u51b3\uff09\uff1a<\/p>\n

1. \u5f00\u542foracle\u8f93\u51fa<\/strong><\/div>\n

\u67e5\u4e86\u8d44\u6599\uff0c\u8bf4\u662foracle\u9ed8\u8ba4\u662f\u5173\u95ed\u7684\u3002 \u8981\u6267\u884c :<\/p>\n

set serveroutput on;<\/pre>\n

\u624d\u53ef\u4ee5\uff0c\u4e8e\u662f\u5728pl\/sql develope\u4e2d\u6267\u884c\u8be5\u8bed\u53e5\uff0c\u62a5\u9519\uff0c\u539f\u56e0\uff1a pl\/sql\u4e0d\u652f\u6301\u3002<\/p>\n

\u89e3\u51b3\uff1a \u5728windows cmd \u4e2d\u6267\u884c sqlplus \u547d\u4ee4\u3002<\/p>\n

2. \u7528sqlplus \u767b\u9646oracle<\/strong><\/div>\n
1\u3001\u5f00\u59cb\u5728cmd \u91cc\u6267\u884c\uff1a sqlplus \/nolog<\/strong><\/span><\/div>\n

\u62a5\u9519\uff1a \u5927\u610f\u662f \u65e0\u6b64\u547d\u4ee4<\/p>\n

\u5927\u4f53\u539f\u56e0\uff1a \u6ca1\u6709\u5b89\u88c5oracle\u5ba2\u6237\u7aef\uff0c\u6216\u8005\u662f\u73af\u5883\u53d8\u91cf\u51fa\u73b0\u4e86\u95ee\u9898\u3002<\/p>\n

\u89e3\u51b3\uff1a \u6211\u7684\u662f\u91cd\u65b0\u5b89\u88c5\u4e86oralce\u5ba2\u6237\u7aef, \u7136\u540e\u9700\u8981\u770b\u4e0b\u73af\u5883\u53d8\u91cf\u91cc\u8fb9\u6709\u6ca1\u6709\u8fd9\u4e2a\u53d8\u91cf\uff0c\u6ca1\u6709\u7684\u8bdd\u8981\u624b\u52a8\u52a0\u4e0a\uff0c\u4e00\u822c\u91cd\u65b0\u5b89\u88c5\u90fd\u662f\u6709\u7684\u3002<\/p>\n

2\u3001\u6267\u884csqlplus\/nolog<\/strong><\/span><\/div>\n

\u7136\u540e\u8f93\u5165oracle\u94fe\u63a5\u4fe1\u606f \u3002\u6211\u8fd9\u91cc\u662f\u94fe\u63a5\u8fdc\u7a0b\u7684\u6570\u636e\u5e93<\/p>\n

\u683c\u5f0f\uff1asqlplus user\/pwd@host_ip:port\/\u5b9e\u4f8b\u540d<\/p>\n

\u793a\u4f8b\uff1asqlplus xxgx\/xxxx@101.101.xx.xx:1521\/orcl<\/p>\n

\u767b\u9646\u8fdc\u7a0b\u7684\u539f\u56e0\uff0c\u4f1a\u6709\u7a0d\u5fae\u505c\u987f\uff0c\u8fde\u63a5\u4e0a\u53bb\u4ee5\u540e\u3002 \u53ef\u4ee5\u6267\u884c show user; \u663e\u793a\u5f53\u524d\u7528\u6237\u3002<\/p>\n

\u6b63\u786e\u663e\u793a\u8bf4\u660e\u767b\u9646\u6210\u529f\u3002<\/p>\n

\u9644\u52a0\uff1a \u67e5\u770b\u5f53\u524d\u7528\u6237\u4e0b\u7684\u6240\u6709\u8868\uff1a<\/p>\n

select TABLE_NAME from USER_TABLES;<\/pre>\n

\u81f3\u6b64sqlplus\u6210\u529f\u767b\u9646\u3002<\/p>\n

3. pl\/sql\u6267\u884c\u8f93\u51fa\u8bed\u53e5<\/strong><\/div>\n

\u6267\u884c\uff1a<\/p>\n

--pl\/sql\u7f16\u7a0b\u8bed\u8a00\r\n--pl\/sql\u7f16\u7a0b\u8bed\u8a00\u662f\u5bf9sql\u8bed\u8a00\u7684\u6269\u5c55\uff0c\u4f7f\u5f97sql\u8bed\u8a00\u5177\u6709\u8fc7\u7a0b\u5316\u53d8\u7f16\u7a0b\u7684\u7279\u6027\u3002\r\n--pl\/sql\u7f16\u7a0b\u8bed\u8a00\u6bd4\u4e00\u822c\u7684\u8fc7\u7a0b\u5316\u7f16\u7a0b\u8bed\u8a00\uff0c\u66f4\u52a0\u7075\u6d3b\u9ad8\u6548\u3002\r\n--pl\/sql\u7f16\u7a0b\u8bed\u8a00\u4e3b\u8981\u7528\u6765\u7f16\u5199\u5b58\u50a8\u8fc7\u7a0b\u548c\u5b58\u50a8\u51fd\u6570\u7b49\u3002\r\n \r\n--\u751f\u547d\u65b9\u6cd5\r\n--\u8d4b\u503c\u64cd\u4f5c\u53ef\u4ee5\u4f7f\u7528=\uff1a \u4e5f\u53ef\u4ee5\u4f7f\u7528into\u67e5\u8be2\u8bed\u53e5\u8d4b\u503c\u3002\r\n \r\ndeclare\r\n          i number(2) := 10 ;\r\n          s varchar2(10) := '\u54c8dd\u54c8' ;\r\n          ena XXGX_TJ_RBBTJ.SYS_TIME%type ; -- \u5f15\u7528\u578b\u53d8\u91cf\r\nbegin\r\n          dbms_output.put_line(i);\r\n          dbms_output.put_line(s);\r\n          select SYS_TIME into ena from XXGX_TJ_RBBTJ where ID = 1000060;\r\n          dbms_output.put_line(ena);\r\nend;<\/pre>\n

\u663e\u793a\uff1a<\/p>\n

\"\"<\/p>\n

\u8fd9\u91cc\u8981\u8bf4\u7684\u5c31\u662f \u8fd9\u4e2a\u8f93\u51fa\u554a\uff0c\u5f00\u59cb\u627e\u534a\u5929\u6ca1\u627e\u5230\u5728\u54ea\u8f93\u51fa\uff0c\u5c31\u5728SQL\u65c1\u8fb9\u6709\u4e2aOutput\u7684\u7a97\u53e3\u3002\u70b9\u51fb\u5373\u53ef\u770b\u5230\u3002\u5c31\u8fd9\u5f53\u65f6\u8fd8\u61f5\u5708\u4e86 \u54ce\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6700\u8fd1\u5199\u4e86oracle\u8fc7\u7a0b\uff0c\u6709\u4e2aORACLE\u4e2ddbms_output.put_line\u8f93\u51fa\u4e0d\u4e86\u7684\u95ee\u9898\u3002 \u82b1\u4e86\u8fd1\u4e00 […]<\/p>\n","protected":false},"author":362,"featured_media":75099,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-246583","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/246583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=246583"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/246583\/revisions"}],"predecessor-version":[{"id":246590,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/246583\/revisions\/246590"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/75099"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=246583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=246583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=246583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}