{"id":1092,"date":"2015-11-09T10:32:40","date_gmt":"2015-11-09T10:32:40","guid":{"rendered":"http:\/\/62.131.51.129\/?p=1092"},"modified":"2015-11-09T10:32:40","modified_gmt":"2015-11-09T10:32:40","slug":"generate-table-in-oracle","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=1092","title":{"rendered":"Generate table in Oracle"},"content":{"rendered":"<p>I regularly happens to me that I want to generate a random set of records in an Oracle table. That could happen if we want to assess performance of a certain procedure. Or (other example) if we want to estimate the size of a table. A great thing of Oracle is the random function where random strings and numbers can be generated.<br \/>\nI created a table (GROOT) that contains three fields: an integer, a 10 character string and a date.<br \/>\nThis can be loaded with this script. Within the script you will find also a number that indicates the number of records being generated. In my case, it is 2 million.<br \/>\nThis scipt work blazingly fast. Within seconds, I had my table being loaded.<\/p>\n<pre>\n\ninsert into SCOTT.GROOT\nSELECT ROWNUM n\n, dbms_random.string('U', 10)\n, to_date('2014-01-01', 'yyyy-mm-dd')+trunc(dbms_random.value(1,1000))\nFROM ( SELECT 1 just_a_column\nFROM dual\nCONNECT BY LEVEL <= 2000000\n);\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I regularly happens to me that I want to generate a random set of records in an Oracle table. That could happen if we want to assess performance of a certain procedure. Or (other example) if we want to estimate the size of a table. A great thing of Oracle is the random function where [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1094,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1092","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nice-to-know"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/1092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1092"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/1092\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1092"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}