{"id":3239,"date":"2020-01-16T10:02:06","date_gmt":"2020-01-16T09:02:06","guid":{"rendered":"http:\/\/van-maanen.com\/?p=3239"},"modified":"2020-01-16T10:02:06","modified_gmt":"2020-01-16T09:02:06","slug":"oracle-numerical-data","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=3239","title":{"rendered":"Oracle numerical data"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Numbers can be stored in Oracle according to different formats. On one hand, we have the American way, whereby numbers are stored with a dot (.) as decimal indicator. On the other hand, we have a comma (,) as decimal indicator. Let me provide my own Oracle instance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have the following language settings:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select * from nls_session_parameters;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">which provides:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">NLS_LANGUAGE    ENGLISH<br>NLS_TERRITORY    AMERICA<br>NLS_NUMERIC_CHARACTERS    .,<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This means that numbers are interpreted with a dot (.) as decimal indicator. I created a small table with numbers that shows this dot:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2020\/01\/Capture-17-3-1-1.png\" alt=\"\" class=\"wp-image-3240\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">It is possible to change the settings for a session. To that end, we fire next command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ', ';<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To check if numbers are now interpreted as having as decimal indicator being a comma, we try:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">insert into nummer(getal) values('1,45');<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This looks successful. To check if &#8216;1,45&#8217; is really inserted, we display the data:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2020\/01\/Capture-17-4-1-1.png\" alt=\"\" class=\"wp-image-3241\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">It is also possible to change the settings that determine the decimal point. These settings are derived from the computer one is working. On a windows machine, one may create a setting in the environmental variables:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2020\/01\/Capture-17-5-1-1.png\" alt=\"\" class=\"wp-image-3242\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A variable NLS_LANG either exists or must be created. On my machine, it is AMERICAN_AMERICA.WE8MSWIN1252.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let us change this to  DUTCH_THE NETHERLANDS.WE8MSWIN1252 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is also possible to set this variable in the registry:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2020\/01\/Capture-17-6-1-1.png\" alt=\"\" class=\"wp-image-3243\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This is done. Then the machine is restarted. After a restart, we check if the comma is used as decimal separator. This is the indeed the case:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2020\/01\/Capture-17-7-1-1.png\" alt=\"\" class=\"wp-image-3245\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Numbers can be stored in Oracle according to different formats. On one hand, we have the American way, whereby numbers are stored with a dot (.) as decimal indicator. On the other hand, we have a comma (,) as decimal indicator. Let me provide my own Oracle instance. I have the following language settings: select [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3239","post","type-post","status-publish","format-standard","hentry","category-nice-to-know"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3239","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=3239"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3239\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3239"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}