{"id":14700,"date":"2020-04-25T21:33:31","date_gmt":"2020-04-25T21:33:31","guid":{"rendered":"https:\/\/ittutorial.org\/?p=14700"},"modified":"2020-04-28T00:36:03","modified_gmt":"2020-04-28T00:36:03","slug":"pl-sql-number-functions","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/pl-sql-number-functions\/","title":{"rendered":"PL\/SQL &#8211; Number Functions"},"content":{"rendered":"<p style=\"text-align: justify\">Hi Folks,<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Functions are similar to operators in that they manipulate data items and return a result. Functions differ from operators in the format of their arguments. This format enables them to operate on zero, one, two, or more arguments. SQL functions are built into Oracle Database and are available for use in various appropriate SQL statements.<\/p>\n<p style=\"text-align: justify\">Numeric functions accept numeric input and return numeric values. Most numeric functions that return\u00a0NUMBER\u00a0values that are accurate to 38 decimal digits. The transcendental functions\u00a0COS,\u00a0COSH,\u00a0EXP,\u00a0LN,\u00a0LOG,\u00a0SIN,\u00a0SINH,\u00a0SQRT,\u00a0TAN, and\u00a0TANH\u00a0are accurate to 36 decimal digits. The transcendental functions\u00a0ACOS,\u00a0ASIN,\u00a0ATAN, and\u00a0ATAN2\u00a0are accurate to 30 decimal digits.<\/p>\n<p>&nbsp;<\/p>\n<h2>Most Used Functions<\/h2>\n<table style=\"width: 99.9427%\" width=\"922\">\n<tbody>\n<tr>\n<td style=\"width: 31.8919%\" width=\"295\">SYNTAX<\/td>\n<td style=\"width: 74.3784%\" width=\"627\">DESCRIPTION<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">ABS(n)<\/td>\n<td style=\"width: 74.3784%\">ABS returns the absolute value of n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">CEIL(n)<\/td>\n<td style=\"width: 74.3784%\">CEIL returns smallest integer greater than or equal to n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">EXP(n)<\/td>\n<td style=\"width: 74.3784%\">EXP returns e raised to the nth power, where e = 2.71828183<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">FLOOR(n)<\/td>\n<td style=\"width: 74.3784%\">FLOOR returns largest integer equal to or less than n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">LN(n)<\/td>\n<td style=\"width: 74.3784%\">LN returns the natural logarithm of n, where n is greater than 0.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">LOG(n2, n1)<\/td>\n<td style=\"width: 74.3784%\">LOG returns the logarithm, base n2, of n1<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">MOD(n2, n1)<\/td>\n<td style=\"width: 74.3784%\">MOD returns the remainder of n2 divided by n1. Returns n2 if n1 is 0.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">POWER(n2, n1)<\/td>\n<td style=\"width: 74.3784%\">POWER returns n2 raised to the n1 power.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">REMAINDER(n2, n1)<\/td>\n<td style=\"width: 74.3784%\">REMAINDER returns the remainder of n2 divided by n1.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">ROUND(n, interger)<\/td>\n<td style=\"width: 74.3784%\">ROUND returns n rounded to integer places to the right of the decimal point. If you omit integer, then n is rounded to 0 places.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">SIGN(n)<\/td>\n<td style=\"width: 74.3784%\">SIGN returns -1 if n&lt;0, 0 if n=0, and 1 if n&gt;0<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">SQRT(n)<\/td>\n<td style=\"width: 74.3784%\">SQRT returns the square root of n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">TRUNC(n1, n2)<\/td>\n<td style=\"width: 74.3784%\">The TRUNC (number) function returns n1 truncated to n2 decimal places. If n2 is omitted, then n1 is truncated to 0 places.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre>SELECT\r\n      ABS(-15) \"Absolute\"\r\n    , CEIL(268651.8) \"CEIL\"\r\n    , EXP(4) \"e to the 4th power\"\r\n    , FLOOR(15.7) \"Floor\"\r\n    , LN(95) \"Natural log of 95\" \r\n    , LOG(10,100) \"Log base 10 of 100\"\r\n    , MOD(11,4) \"Modulus\" \r\n    , POWER(3,2) \"Raised\"\r\n    , REMAINDER(21.23, 1) \"Remainder\"\r\n    , ROUND(15.193,1) \"Round\"\r\n    , SIGN(-15) \"Sign\"\r\n    , SQRT(25) \"Square root\"\r\n    , TRUNC(15.79,1) \"Truncate\" \r\nFROM DUAL;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14703\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_14_24-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-300x71.png\" alt=\"\" width=\"845\" height=\"200\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_14_24-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-300x71.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_14_24-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-1024x243.png 1024w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_14_24-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-768x182.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_14_24-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox.png 1471w\" sizes=\"auto, (max-width: 845px) 100vw, 845px\" \/><\/p>\n<h2><\/h2>\n<h2>Trigonometric Functions<\/h2>\n<table style=\"width: 99.9199%\" width=\"922\">\n<tbody>\n<tr>\n<td style=\"width: 31.8919%\" width=\"295\">SYNTAX<\/td>\n<td style=\"width: 74.3557%\" width=\"627\">DESCRIPTION<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">ACOS(n)<\/td>\n<td style=\"width: 74.3557%\">ACOS returns the arc cosine of n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">ASIN(n)<\/td>\n<td style=\"width: 74.3557%\">ASIN returns the arc sine of n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">ATAN(n)<\/td>\n<td style=\"width: 74.3557%\">ATAN returns the arc tangent of n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">ATAN(n1, n2)<\/td>\n<td style=\"width: 74.3557%\">ATAN2 returns the arc tangent of n1 and n2.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">COS(n)<\/td>\n<td style=\"width: 74.3557%\">COS returns the cosine of n (an angle expressed in radians).<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">COSH(n)<\/td>\n<td style=\"width: 74.3557%\">COSH returns the hyperbolic cosine of n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">SIN(n)<\/td>\n<td style=\"width: 74.3557%\">SIN returns the sine of n (an angle expressed in radians).<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">SINH(n)<\/td>\n<td style=\"width: 74.3557%\">SINH returns the hyperbolic sine of n.<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">TAN(n)<\/td>\n<td style=\"width: 74.3557%\">TAN returns the tangent of n (an angle expressed in radians).<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 31.8919%\">TANH(n)<\/td>\n<td style=\"width: 74.3557%\">TANH returns the hyperbolic tangent of n.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre>SELECT\r\n      ACOS(.3)\"Arc_Cosine\"\r\n    , ASIN(.3) \"Arc_Sine\"\r\n    , ATAN(.3) \"Arc_Tangent\"\r\n    , ATAN2(.3, .2) \"Arc_Tangent2\"\r\n    , COS(180 * 3.14159265359\/180) \"COS\"\r\nFROM DUAL;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14705\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_21_18-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-300x47.png\" alt=\"\" width=\"824\" height=\"129\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_21_18-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-300x47.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_21_18-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-1024x161.png 1024w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_21_18-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-768x121.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_21_18-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox.png 1505w\" sizes=\"auto, (max-width: 824px) 100vw, 824px\" \/><\/p>\n<p>&nbsp;<\/p>\n<pre>SELECT \r\n      COSH(0) \"Hyperbolic cosine of 0\"\r\n    , SIN(30 * 3.14159265359\/180) \"Sine of 30 degrees\"\r\n    , SINH(1) \"Hyperbolic sine of 1\"\r\n    , TAN(135 * 3.14159265359\/180)  \"Tangent of 135 degrees\"\r\n    , TANH(.5) \"Hyperbolic tangent of .5\"\r\nFROM DUAL;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14706\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_23_32-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-300x55.png\" alt=\"\" width=\"840\" height=\"154\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_23_32-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-300x55.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_23_32-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-1024x187.png 1024w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_23_32-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox-768x140.png 768w, https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/2020-04-25-17_23_32-ODI-12c-Getting-Started-VM-OTN-122131-Running-Oracle-VM-VirtualBox.png 1396w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Please write down in the comments any further questions you may have. I&#8217;ll be happy to help you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi Folks, &nbsp; Functions are similar to operators in that they manipulate data items and return a result. Functions differ from operators in the format of their arguments. This format enables them to operate on zero, one, two, or more arguments. SQL functions are built into Oracle Database and are available for use in various &hellip;<\/p>\n","protected":false},"author":10477,"featured_media":14709,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1994,3019,3647],"tags":[3617,9290,3717,9294,9292,9291,9293],"class_list":["post-14700","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-oracle","category-oracle-sql","category-pl-sql","tag-oracle-pl-sql","tag-oracle-pl-sql-number-functions","tag-oracle-plsql","tag-oracle-trigonometric-functions","tag-pl-sql-functions","tag-pl-sql-number-functions","tag-pl-sql-trigonometric-functions"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2020\/04\/PLSQL_ICO.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/14700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/10477"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=14700"}],"version-history":[{"count":6,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/14700\/revisions"}],"predecessor-version":[{"id":14710,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/14700\/revisions\/14710"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/14709"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=14700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=14700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=14700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}