{"id":41901,"date":"2023-08-02T08:57:21","date_gmt":"2023-07-27T08:50:21","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/"},"modified":"2024-04-30T16:36:01","modified_gmt":"2024-04-30T08:36:01","slug":"%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/","title":{"rendered":"\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6"},"content":{"rendered":"<p>\u4ee5\u4e0b\u662f\u5173\u4e8e\u4eceOracle Database\u8fc1\u79fb\u5230PostgreSQL\u65f6\u4e24\u8005\u4e4b\u95f4\u91cd\u8981\u5dee\u5f02\u7684\u63cf\u8ff0\u3002<\/p>\n<h1>1. \u5b58\u50a8\u67b6\u6784\u7684\u5dee\u5f02<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d496137434c4406caf914\/2-1.png\" alt=\"image.png\" \/><\/div>\n<h1>2. \u4ea4\u6613\u7684\u5dee\u5f02 de<\/h1>\n<h2>PostgreSQL\u9ed8\u8ba4\u81ea\u52a8\u63d0\u4ea4<\/h2>\n<p>\u5bf9\u4e8e\u5df2\u7ecf\u719f\u6089\u4f7f\u7528Oracle\u6570\u636e\u5e93\u7684\u5de5\u7a0b\u5e08\u6765\u8bf4\uff0cPostgreSQL\u7684\u81ea\u52a8\u63d0\u4ea4\u662f\u4e00\u4e2a\u76f8\u5bf9\u964c\u751f\u7684\u7279\u70b9\u3002\u5728Oracle\u6570\u636e\u5e93\u4e2d\uff0c\u6267\u884c\u5b8cInsert\u3001Delete\u3001Update\u7b49DML\u64cd\u4f5c\u540e\uff0c\u5fc5\u987b\u663e\u5f0f\u5730\u6267\u884cCOMMIT\u624d\u80fd\u5c06\u66f4\u6539\u53cd\u6620\u51fa\u6765\uff0c\u5982\u679c\u60f3\u8981\u64a4\u9500\u66f4\u6539\uff0c\u8fd8\u9700\u8981\u663e\u5f0f\u5730\u6267\u884cROLLBACK\u3002\u800c\u5728PostgreSQL\u4e2d\uff0c\u6267\u884cDML\u64cd\u4f5c\u540e\uff0c\u66f4\u6539\u4f1a\u7acb\u5373\u751f\u6548\uff0c\u81ea\u52a8\u63d0\u4ea4\u3002\u5982\u679c\u60f3\u8981\u5c06\u5176\u4f5c\u4e3a\u4e00\u4e2a\u4e8b\u52a1\u8fdb\u884c\u6267\u884c\uff0c\u9700\u8981\u663e\u5f0f\u5730\u4f7f\u7528BEGIN\u6765\u542f\u52a8\u4e8b\u52a1\uff0c\u8981\u63d0\u4ea4\u4e8b\u52a1\u5219\u9700\u8981\u4f7f\u7528END\u6216COMMIT\uff0c\u8981\u8fdb\u884c\u56de\u6eda\u5219\u9700\u8981\u6267\u884cROLLBACK\u3002<\/p>\n<h2>\u5728PostgreSQL\u4e2d\uff0cDDL\u64cd\u4f5c\u4e5f\u53ef\u4ee5\u8fdb\u884c\u56de\u6eda\u3002<\/h2>\n<p>\u5728Oracle\u6570\u636e\u5e93\u4e2d\uff0cDDL\u8bed\u53e5\u4f1a\u8fdb\u884c\u9690\u5f0f\u63d0\u4ea4\u3002\u800c\u5728PostgreSQL\u4e2d\uff0c\u7531\u4e8e\u4e0d\u6267\u884c\u9690\u5f0f\u63d0\u4ea4\uff0c\u56e0\u6b64\u53ef\u4ee5\u56de\u6eda\u50cf\u5728\u4e8b\u52a1\u4e2d\u6267\u884c\u7684CREATE TABLE\u8fd9\u6837\u7684DDL\u8bed\u53e5\u3002<\/p>\n<h2>\u5728\u4ea4\u6613\u8fc7\u7a0b\u4e2d\u5bf9\u9519\u8bef\u7684\u63a7\u5236\u3002<\/h2>\n<p>du\u00ec de<\/p>\n<p>\u5728Oracle\u6570\u636e\u5e93\u4e2d\uff0c\u5373\u4f7f\u5728\u6267\u884c\u4e86\u4e00\u4e9bDML\u64cd\u4f5c\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u53ea\u8981\u5728\u6700\u540e\u8fdb\u884cCOMMIT\u64cd\u4f5c\uff0c\u90a3\u4e48\u88ab\u6210\u529f\u6267\u884c\u7684DML\u64cd\u4f5c\u7684\u5904\u7406\u5c31\u4f1a\u88ab\u786e\u8ba4\u3002\u800c\u5728PostgreSQL\u4e2d\uff0c\u5982\u679c\u5728BEGIN\u4e4b\u540e\u51fa\u73b0\u4e86\u4efb\u4f55\u9519\u8bef\uff0c\u5373\u4f7f\u6700\u540e\u8fdb\u884c\u4e86COMMIT\u64cd\u4f5c\uff0c\u5904\u7406\u7ed3\u679c\u4f1a\u88ab\u89c6\u4e3a\u6267\u884c\u4e86ROLLBACK\u64cd\u4f5c\u4e00\u6837\u3002<\/p>\n<h1>3. \u5b9a\u4e49\u5dee\u5f02\uff08\u6570\u636e\u7c7b\u578b\u89c4\u5b9a\uff09<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d496137434c4406caf914\/11-0.png\" alt=\"image.png\" \/><\/div>\n<h1>4. \u6570\u636e\u8fde\u7eed\u751f\u6210<\/h1>\n<p>\u5728\u751f\u6210\u8fde\u7eed\u6570\u5b57\u65f6\uff0cOracle Database\u548cPostgreSQL\u90fd\u6709\u5e8f\u5217\uff08sequence\uff09\u548c\u81ea\u52a8\u9012\u589e\u5217\u7684\u529f\u80fd\u5b58\u5728\u3002\u7136\u800c\uff0c\u5b83\u4eec\u7684\u8868\u793a\u65b9\u6cd5\u7565\u6709\u4e0d\u540c\u3002<\/p>\n<div>\n<div class=\"post-table\">\n\u9806\u5e8f\u81ea\u52d5\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8OracleCREATE SEQUENCE deptseq<br \/>\nSTART WITH 1 INCREMENT BY 1;CREATE TABLE test<br \/>\n(testno NUMBER GENERATED ALWAYS AS IDENTITY);PostgreSQLCREATE SEQUENCE deptseq<br \/>\nSTART WITH 1 INCREMENT BY 1;CREATE TABLE test (testno SERIAL);<\/div>\n<\/div>\n<h1>5.\u540c\u4e49\u8bcd\u7684\u6709\u65e0<\/h1>\n<p>\u5728Oracle\u6570\u636e\u5e93\u4e2d\uff0c\u5b58\u5728\u540c\u4e49\u8bcd\uff0c\u4f46\u5728PostgreSQL\u4e2d\u5374\u4e0d\u5b58\u5728\u3002\u56e0\u6b64\uff0c\u5728PostgreSQL\u4e2d\u9700\u8981\u5c06Oracle\u6570\u636e\u5e93\u4e2d\u7684\u540c\u4e49\u8bcd\u66ff\u6362\u4e3a\u89c6\u56fe\u3002<\/p>\n<div>\n<div class=\"post-table\">\n<p>Oracle Database\u30d1\u30d6\u30ea\u30c3\u30af\u30b7\u30ce\u30cb\u30e0\/\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30b7\u30ce\u30cb\u30e0PostgreSQL\u30b7\u30ce\u30cb\u30e0\u306f\u5b58\u5728\u3057\u306a\u3044<\/p><\/div>\n<\/div>\n<h1>6. \u5305\u88dd\u3001\u904e\u7a0b<\/h1>\n<p>\u5728PostgreSQL\u4e2d\uff0c\u6ca1\u6709\u5305\uff08package\uff09\u7684\u6982\u5ff5\u3002\u7136\u800c\uff0c\u6709\u591a\u79cd\u7c7b\u578b\u7684\u5b58\u50a8\u8fc7\u7a0b\uff08procedure\uff09\u53ef\u7528\uff0c\u5982PL\/pgSQL\u3001PL\/Python\u3001PL\/Perl\u7b49\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u5c06Oracle Database\u4e2d\u7684\u5b58\u50a8\u8fc7\u7a0b\u66f4\u6539\u4e3a\u8fd9\u4e9b\u9009\u9879\u4e4b\u4e00\u3002<\/p>\n<div>\n<div class=\"post-table\">\n\u30d1\u30c3\u30b1\u30fc\u30b8\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3Oracle Database\u5b58\u5728\u3059\u308b\u5b58\u5728\u3059\u308bPostgreSQL\u5b58\u5728\u3057\u306a\u3044\u5b58\u5728\u3059\u308b(PL\/pgSQL, PL\/Python, PL\/Tcl, PL\/Perl)<\/div>\n<\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d496137434c4406caf914\/21-0.png\" alt=\"image.png\" \/><\/div>\n<h1>7. \u5185\u7f6e\u51fd\u6570<\/h1>\n<p>Oracle Database\u548cPostgreSQL\u7684\u5185\u7f6e\u51fd\u6570\u6709\u6240\u4e0d\u540c\u3002\u7531\u4e8e\u5728\u79fb\u690d\u5230PostgreSQL\u65f6\uff0c\u67d0\u4e9b\u5728Oracle Database\u4e2d\u53ef\u7528\u7684\u5185\u7f6e\u51fd\u6570\u53ef\u80fd\u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u9700\u8981\u6ce8\u610f\u3002\uff08\u5982\u679c\u4e0d\u5b58\u5728\u76f8\u5e94\u7684\u5185\u7f6e\u51fd\u6570\uff0c\u5219\u9700\u8981\u5b9a\u4e49\u5b9e\u73b0\u76f8\u540c\u529f\u80fd\u7684\u81ea\u5b9a\u4e49\u51fd\u6570\u3002\uff09<\/p>\n<p>\u901a\u8fc7\u5f15\u5165orafce\u63d2\u4ef6\uff0c\u53ef\u4ee5\u5728PostgreSQL\u5185\u5b9e\u73b0\u4e0eOracle\u6570\u636e\u5e93\u517c\u5bb9\u7684\u51fd\u6570\u3002\uff08\u5e76\u975e\u5168\u90e8\u51fd\u6570\uff09<\/p>\n<h1>8. \u5916\u90e8\u5408\u4f5c<\/h1>\n<p>Oracle\u6570\u636e\u5e93\u4f7f\u7528(+)\u4f5c\u4e3a\u5916\u8fde\u63a5\u7684\u72ec\u7279\u8868\u793a\u65b9\u6cd5\uff08\u5c3d\u7ba1\u5728Oracle 9i\u4e4b\u540e\uff0c\u8fd9\u79cd\u8868\u793a\u65b9\u6cd5\u5df2\u4e0d\u63a8\u8350\u4f7f\u7528\uff09\u3002<br \/>\n\u800c\u5728PostgreSQL\u4e2d\uff0c\u4e0d\u5b58\u5728(+)\u7b26\u53f7\uff0c\u56e0\u6b64\u9700\u8981\u5c06\u5176\u8f6c\u6362\u4e3a[LEFT\/RIGHT] OUTER JOIN\u3002<\/p>\n<p>Instead of repeating numbers, let&#8217;s just use Roman numerals.<\/p>\n<pre class=\"post-pre\"><code><span class=\"c1\">--Oracle Database\u306e\u5834\u5408<\/span>\r\n<span class=\"k\">SELECT<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span><span class=\"p\">,<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">dname<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">empno<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">ename<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">comm<\/span>\r\n<span class=\"k\">FROM<\/span> <span class=\"n\">emp<\/span> <span class=\"n\">e<\/span><span class=\"p\">,<\/span> <span class=\"n\">dept<\/span> <span class=\"n\">d<\/span>\r\n<span class=\"k\">WHERE<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span><span class=\"p\">(<\/span><span class=\"o\">+<\/span><span class=\"p\">)<\/span> <span class=\"o\">=<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span>\r\n<span class=\"k\">AND<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">comm<\/span><span class=\"p\">(<\/span><span class=\"o\">+<\/span><span class=\"p\">)<\/span> <span class=\"o\">=<\/span> <span class=\"mi\">300<\/span><span class=\"p\">;<\/span>\r\n\r\n<span class=\"c1\">--PostgreSQL\u306e\u5834\u5408<\/span>\r\n<span class=\"k\">SELECT<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span><span class=\"p\">,<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">dname<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">empno<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">ename<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">comm<\/span>\r\n<span class=\"k\">FROM<\/span> <span class=\"n\">scott<\/span><span class=\"p\">.<\/span><span class=\"n\">emp<\/span> <span class=\"n\">e<\/span>\r\n    <span class=\"k\">RIGHT<\/span> <span class=\"k\">OUTER<\/span> <span class=\"k\">JOIN<\/span> <span class=\"n\">scott<\/span><span class=\"p\">.<\/span><span class=\"n\">dept<\/span> <span class=\"n\">d<\/span> <span class=\"k\">ON<\/span> <span class=\"p\">(<\/span><span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span> <span class=\"o\">=<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span> <span class=\"k\">AND<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">comm<\/span> <span class=\"o\">=<\/span> <span class=\"mi\">300<\/span><span class=\"p\">);<\/span>\r\n<\/code><\/pre>\n<p>\u53ea\u9700\u8981\u4e00\u79cd\u9009\u9879, \u8fdb\u884c\u4ee5\u4e0b\u4e2d\u6587\u7684\u540c\u4e49\u6539\u5199:<br \/>\n\u4f8b\u2461<\/p>\n<pre class=\"post-pre\"><code><span class=\"c1\">--Oracle Database\u306e\u5834\u5408<\/span>\r\n<span class=\"k\">SELECT<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span><span class=\"p\">,<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">dname<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">empno<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">ename<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">comm<\/span>\r\n<span class=\"k\">FROM<\/span> <span class=\"n\">emp<\/span> <span class=\"n\">e<\/span><span class=\"p\">,<\/span> <span class=\"n\">dept<\/span> <span class=\"n\">d<\/span>\r\n<span class=\"k\">WHERE<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span><span class=\"p\">(<\/span><span class=\"o\">+<\/span><span class=\"p\">)<\/span> <span class=\"o\">=<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span>\r\n<span class=\"k\">AND<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">comm<\/span> <span class=\"o\">=<\/span> <span class=\"mi\">300<\/span><span class=\"p\">;<\/span>\r\n\r\n<span class=\"c1\">--PostgreSQL\u306e\u5834\u5408<\/span>\r\n<span class=\"k\">SELECT<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span><span class=\"p\">,<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">dname<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">empno<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">ename<\/span><span class=\"p\">,<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">comm<\/span>\r\n<span class=\"k\">FROM<\/span> <span class=\"n\">scott<\/span><span class=\"p\">.<\/span><span class=\"n\">emp<\/span> <span class=\"n\">e<\/span>\r\n    <span class=\"k\">RIGHT<\/span> <span class=\"k\">OUTER<\/span> <span class=\"k\">JOIN<\/span> <span class=\"n\">scott<\/span><span class=\"p\">.<\/span><span class=\"n\">dept<\/span> <span class=\"n\">d<\/span>\r\n        <span class=\"k\">ON<\/span> <span class=\"p\">(<\/span><span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span> <span class=\"o\">=<\/span> <span class=\"n\">d<\/span><span class=\"p\">.<\/span><span class=\"n\">deptno<\/span><span class=\"p\">)<\/span>\r\n<span class=\"k\">WHERE<\/span> <span class=\"n\">e<\/span><span class=\"p\">.<\/span><span class=\"n\">comm<\/span> <span class=\"o\">=<\/span> <span class=\"mi\">300<\/span><span class=\"p\">;<\/span>\r\n<\/code><\/pre>\n<h1>9.\u884c\u7ea7\u9501<\/h1>\n<p>\u4e3a\u4e86\u907f\u514d\u7531\u4e8e\u5171\u4eab\u800c\u5bfc\u81f4\u7684\u4e00\u822c\u4e1a\u52a1\u903b\u8f91\u4e0a\u7684\u4e0d\u4e00\u81f4\uff0c\u4e00\u822c\u6709\u4f7f\u7528SELECT FOR UPDATE\u3002\u5728Oracle\u6570\u636e\u5e93\u548cPostgreSQL\u4e2d\uff0c\u90fd\u5b58\u5728SELECT FOR UPDATE\u64cd\u4f5c\uff0c\u53ef\u4ee5\u4ee5\u76f8\u540c\u7684\u65b9\u5f0f\u83b7\u53d6\u884c\u7ea7\u9501\u3002\u7136\u800c\uff0c\u5728Oracle\u6570\u636e\u5e93\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528FOR UPDATE\u5b50\u53e5\u4e2d\u7684WAIT n\u548cNOWAIT\uff0c\u4f46\u5728PostgreSQL\u4e2d\uff0c\u867d\u7136\u5b58\u5728FOR UPDATE\u5b50\u53e5\uff0c\u4f46\u4e0d\u5b58\u5728WAIT n\u548cNOWAIT\uff08\u4e00\u76f4\u7b49\u5f85\u76f4\u5230\u9501\u88ab\u91ca\u653e\uff09\u3002\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u53c2\u6570lock_timeout\u6765\u8bbe\u7f6e\u8d85\u8fc7\u8bbe\u5b9a\u503c\u7684\u7b49\u5f85\u65f6\u95f4\u5bfc\u81f4\u9519\u8bef\uff0c\u56e0\u6b64\u9700\u8981\u901a\u8fc7\u8c03\u6574\u8fd9\u4e2a\u53c2\u6570\u6765\u8fdb\u884c\u8bbe\u7f6e\uff08\u8fd9\u4e2a\u53c2\u6570\u4e5f\u53ef\u4ee5\u5728\u4f1a\u8bdd\u7ea7\u522b\u8fdb\u884c\u66f4\u6539\uff09\u3002<\/p>\n<h1>10\u4e2a\u63d0\u793a<\/h1>\n<p>Oracle\u6570\u636e\u5e93\u6709\u63d0\u793a\u8bed\u53e5\uff0c\u4f46\u5728PostgreSQL\u4e2d\u6ca1\u6709\u63d0\u793a\u8bed\u53e5\u3002\uff08\u867d\u7136\u5b58\u5728&#8221;pg_hint_plan&#8221;\u4f5c\u4e3a\u6269\u5c55\u529f\u80fd\uff0c\u4f46\u6ca1\u6709Oracle\u6570\u636e\u5e93\u90a3\u4e48\u591a\u79cd\u7c7b\uff09<br \/>\n\u203b&#8221;pg_hint_plan&#8221;\u5728Azure Database for PostgreSQL\u4e2d\u4e0d\u5b58\u5728\u3002<\/p>\n<h1>11. \u7a7a<\/h1>\n<p>\u5728Oracle Database\u4e2d\uff0cNULL\u548c\u7a7a\u5b57\u7b26\u4e32\u88ab\u89c6\u4e3a\u76f8\u540c\u7684\u4e1c\u897f\uff08NULL\uff09\u3002<br \/>\n\u800c\u5728PostgreSQL\u4e2d\uff0cNULL\u548c\u7a7a\u5b57\u7b26\u4e32\u88ab\u89c6\u4e3a\u4e0d\u540c\u7684\u4e1c\u897f\u3002\u56e0\u6b64\uff0c\u5982\u679c\u8981\u5c06Oracle Database\u8fc1\u79fb\u5230PostgreSQL\uff0c\u5efa\u8bae\u8bbe\u7f6e\u4f7f\u7528NULL\u6216\u7a7a\u5b57\u7b26\u4e32\u7684\u54ea\u4e00\u4e2a\u7684\u89c4\u8303\uff0c\u4f8b\u5982\u7981\u6b62\u4f7f\u7528\u5176\u4e2d\u4e4b\u4e00\u3002<br \/>\n\u5728\u8fdb\u884cNULL\u7684\u56db\u5219\u8fd0\u7b97\u6216\u4e0eNULL\u8fdb\u884c\u5b57\u7b26\u4e32\u8fde\u63a5\u65f6\uff0c\u7ed3\u679c\u90fd\u4f1a\u53d8\u4e3aNULL\uff0c\u56e0\u6b64\u5728\u5904\u7406\u53ef\u80fd\u5b58\u50a8NULL\u7684\u5217\u65f6\uff0c\u9700\u8981\u4f7f\u7528COALESCE\u51fd\u6570\uff08\u76f8\u5f53\u4e8eOracle Database\u4e2d\u7684NVL\u51fd\u6570\uff09\u7b49\u6280\u5de7\u3002<\/p>\n<h1>\u5408\u5e76<\/h1>\n<p>\u5728Oracle Database\u4e2d\uff0c\u5b58\u5728\u7740MERGE\u8bed\u53e5\uff08\u5982\u679c\u5b58\u5728\u5c31\u66f4\u65b0\uff0c\u5426\u5219\u63d2\u5165\uff09\uff0c\u4f46\u5728PostgreSQL\u4e2d\uff0c\u5374\u6ca1\u6709MERGE\u8bed\u53e5\u3002\u4e0e\u6b64\u76f8\u53cd\uff0cPostgreSQL\u63d0\u4f9b\u4e86UPSERT\uff08\u63d2\u5165\u51b2\u7a81\uff09\u8bed\u53e5\uff0c\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u66ff\u4ee3\u3002<\/p>\n<h1>\u6700\u540e<\/h1>\n<p>\u6211\u5e0c\u671b\u80fd\u5411\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0b\u5173\u4e8eOracle\u6570\u636e\u5e93\u548cPostgreSQL\u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u5728\u8fc1\u79fb\u65f6\u9700\u8981\u6ce8\u610f\u7684\u8981\u70b9\u3002<\/p>\n<h2>\u4e0b\u6b21<\/h2>\n<p>\u6211\u60f3\u4ecb\u7ecdAzure Database for PostgreSQL\u7684\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u662f\u5173\u4e8e\u4eceOracle Database\u8fc1\u79fb\u5230PostgreSQL\u65f6\u4e24\u8005\u4e4b\u95f4\u91cd\u8981\u5dee\u5f02\u7684\u63cf\u8ff0\u3002 1. \u5b58\u50a8\u67b6\u6784 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-41901","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4eceoracle\u8fc1\u79fb\u5230azure-db\uff08postgresql\uff09\uff1a\u4e86\u89e3oracle\u548cpostgresql\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6\" \/>\n<meta property=\"og:description\" content=\"\u4ee5\u4e0b\u662f\u5173\u4e8e\u4eceOracle Database\u8fc1\u79fb\u5230PostgreSQL\u65f6\u4e24\u8005\u4e4b\u95f4\u91cd\u8981\u5dee\u5f02\u7684\u63cf\u8ff0\u3002 1. \u5b58\u50a8\u67b6\u6784 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4eceoracle\u8fc1\u79fb\u5230azure-db\uff08postgresql\uff09\uff1a\u4e86\u89e3oracle\u548cpostgresql\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T08:50:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-30T08:36:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d496137434c4406caf914\/2-1.png\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/\",\"name\":\"\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-07-27T08:50:21+00:00\",\"dateModified\":\"2024-04-30T08:36:01+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u4eceoracle\u8fc1\u79fb\u5230azure-db\uff08postgresql\uff09\uff1a\u4e86\u89e3oracle\u548cpostgresql\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6","og_description":"\u4ee5\u4e0b\u662f\u5173\u4e8e\u4eceOracle Database\u8fc1\u79fb\u5230PostgreSQL\u65f6\u4e24\u8005\u4e4b\u95f4\u91cd\u8981\u5dee\u5f02\u7684\u63cf\u8ff0\u3002 1. \u5b58\u50a8\u67b6\u6784 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4eceoracle\u8fc1\u79fb\u5230azure-db\uff08postgresql\uff09\uff1a\u4e86\u89e3oracle\u548cpostgresql\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-07-27T08:50:21+00:00","article_modified_time":"2024-04-30T08:36:01+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d496137434c4406caf914\/2-1.png"}],"author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/","name":"\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-07-27T08:50:21+00:00","dateModified":"2024-04-30T08:36:01+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4eceOracle\u8fc1\u79fb\u5230Azure DB\uff08PostgreSQL\uff09\uff1a\u4e86\u89e3Oracle\u548cPostgreSQL\u768412\u4e2a\u5dee\u5f02\u7684\u91cd\u8981\u77e5\u8bc6"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bb%8eoracle%e8%bf%81%e7%a7%bb%e5%88%b0azure-db%ef%bc%88postgresql%ef%bc%89%ef%bc%9a%e4%ba%86%e8%a7%a3oracle%e5%92%8cpostgresql%e7%9a%8412%e4%b8%aa%e5%b7%ae%e5%bc%82%e7%9a%84%e9%87%8d%e8%a6%81\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=41901"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41901\/revisions"}],"predecessor-version":[{"id":93038,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41901\/revisions\/93038"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=41901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=41901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=41901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}