Dual表是每个数据库创建时默认生成的,该表仅有一列一行。
1)分析dual表执行,如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAABgCAIAAABJz63qAAAD3UlEQVR4nO2dQXLjIBBF++gcRfupWc0BrCWX8GouQPkCzAKLYEDQIIRanv+KcikEAeKpATmJQ79+/0ESmMgCkUDMiRARUecIQ8yJTBJDSrnU19IozutG0zjSxqgK43ObT+gaEc5ZRIwyJ98WreP45WKckvB1bOt8JIrxU0R48emkkQ5NtkyYyZl8iJRLpTKfPUwP0v5kL2qnAz9TU3oQlonOSi+kUJ7Ph5j4e8Hl7RVLy3DOyvSDISbberk/6etO69RxYHNiomrHTGXZWy/NTE+JbtJMM+dMZdWbaaAYm1vwp64xTUNcGJpqZlymffGfKeayiCmsMeFUXi6zl+Mz+3qZ7eHe4pGGb1WMDaIhFFDIiQjqGb3GgCFAzA2AGKFAzBcCMUKBGKFAjFAgRigQIxS6/LcOkLKJFiASMkAkdPWdAfIgYoSCXZlQEDFCgRihQIxQIEYoECMUiBEKxAgFYoQiRcyyLNbaq3shCIgRCsQIBWKEUhJT+FXdlO2UR18/ICaiIiZ6y7OQaYwherjU0Q+IiaiLCXOUUnuZ2ykzIiYbrF/G/cQQ0frJV7q5mRillFLKyXCs6+oy+9oVy83EOBNhiKQ5HeiNI5WMpSLGbDepp5B5BAFiXncSw+cRpI5+QEzEyO1yoZ6UqAxHTPXmYF1xgP7gFX7RWlVSm+6rTb/ehSetMdURrIqhZDOW0upm85GmbjGHatMvrZ/auZm3+Jfva46YaFVzHFnqpEWMfup3eumpu7LCwLVGjBcz5IFGyBqj9dO7uc12OQwOr8EdHN8cChFjAjcjt8unvlcWBYdr1EsaETFSnmOcmzu9u+yDJhIz6llKDlo/my+m7zGlCv85Jt2eFfYU96VyPWkEpGK6oyQE7y5HlKeyR5TMJib7rSPg5zERt4yY/wEp8wDERECMUCBGKFLEgAiIEQrECOUt5vJP6ECK0o8Yzt84g2n0iFFDP2B/bG0cjDH8wvO754jFcKY/19dRk+nY2pgwW1yWBWKmAjFtteV+wBMf+5ymgwiIaa4t1JA9YGrwOdlGIaa5Noj5cjFm34qBmI7aOGKqr9GJKRDTXBvEQEwdiNndLof5/rj6GlaVbRRiZtfGBGJm18bkZmIU+ESKGCZj+0q9/5NoDuu6XtJuaSrbWzmdmL+DgJgsFTFZNxAzgbqY1E2fGCKqinHN2WP/dm0sosVEbjrEuEo4EePFzB+LLNLFhG7OixgLMRsNYrybU8VYSVbsLcTMiRgLMdbaaWsMXwymMoesXZmFmI1JzzHecVkMtssePPlXkChmD4iZwPXvLhPj03uu5XoxQA4QI5R/612UwS822QsAAAAASUVORK5CYII=" alt="" />
2)应用:
在oracle数据库中,dual表作为一个虚表存在的,因为oracle的查询操作语句必须满足格式:select columnname from tablename,其中的from所指向的表示必须的,所以某些非查询操作可以通过dual表来实现,如:
--查看当前日期:
Select sysdate from dual ;
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAL4AAABkCAIAAAC3sx2DAAAFu0lEQVR4nO2dUbLiKhCGWXqW4vvUfZoF6GM24dPdAOUGnAc0It00TYco4P9VaioHoUH47BBz6oy7A2DCfXsAYFQe6vz57y8OHFXHS53v6QuGBOpMiHPOucO3IlBnQr6pjluW7eCbia9+keNGddxbrlpp96RVQDOMOvHsyDNlm8ejhRtyzJUrPYA6hcZ9LgPU+foFK61KCpV14kJN2k8ul/Sc1skFL1bIvdnieHLB2SZS8OgCRE/iOkkrEmcR6h+BtE1mr1zC5YzW0bSS+9UE3NO7EFAYkvAp2qxK/uXDPhe46iQ5Z8N+/w5L/hjlEoy8Hprkz3Ykr19OlNox58Yjv4Xj1LlzW+NO1SmuB1uTrWNWhx2JHG1n1tGPhG2FrHO/5z+I7P5Duduo2l7YMhxbKFSTRyj0latP021RnXuUUWJFhJKEKE5Pe52u0Oeq3wTqMBQ3IiAB6gAjUAd0DdQBRqAOMAJ1gBGoA4xAHWAE6gAjUAcYeamDA0fV8VDnBEAlD3U8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l/UkIZxN+W8D3lxu1JUc4/vDbAvzeqC05wvH/eL8nANp8vN9Cxh5kqH5hPjgt1+v16C7o4NYnrUtn8vv/QcDvD8Kb36Ti8Ptrceh3rbjN7xCCwe/UATK9f2w4c0bj0+9CcYPfqRKh30XKppraKv/aM8et37niW8dv+H1aPPu9KL6p30tb3RSy1JIuz0Nm05b6Ejz7fXj8LrRjiqzPQzbKV/UNuPV7z/tLg9+PRsDW5qmjtbDmL8Gn3/Gdc/o9JA8jrqRm9zj0O1aYn5+QircWACk9j6ZkYp4/T5TkKdoiCwpLfQne/K7lNsdvRv1DRwAocOV3C/j9tXy23we8kzZNofp7f+DMHG2sjn8S42QegjhzAgAAAABJRU5ErkJggg==" alt="" />
--执行其他无特定表操作
如系统函数等。
---------
本系列为最近一段时间学习oracle的学习笔记,记录于此作为自身回顾,其中有的来的网络,有的来的书籍,但时间已久,记不清哪些是引用,如是转载但没标注出,特意致歉。