{"id":19331,"date":"2021-08-09T06:54:52","date_gmt":"2021-08-08T20:54:52","guid":{"rendered":"https:\/\/database.guide\/?p=19331"},"modified":"2021-08-09T06:54:52","modified_gmt":"2021-08-08T20:54:52","slug":"systimestamp-function-in-oracle","status":"publish","type":"post","link":"https:\/\/database.guide\/systimestamp-function-in-oracle\/","title":{"rendered":"SYSTIMESTAMP Function in Oracle"},"content":{"rendered":"\n<p>In Oracle Database, the <code>SYSTIMESTAMP<\/code> function returns the system date, including fractional seconds and time zone, of the system on which the database resides.<\/p>\n\n\n\n<p>The returned value is of type&nbsp;<code>TIMESTAMP WITH TIME ZONE<\/code>.&nbsp;<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Syntax<\/h2>\n\n\n\n<p>The syntax goes like this: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SYSTIMESTAMP<\/code><\/pre>\n\n\n\n<p>So, no arguments are required (or accepted), and there are no parentheses.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example<\/h2>\n\n\n\n<p>Here&#8217;s an example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT SYSTIMESTAMP\nFROM DUAL;<\/code><\/pre>\n\n\n\n<p>Result:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">06\/AUG\/21 07:45:00.540362000 PM -04:00<\/pre>\n\n\n\n<p>This example displays the date based on the value of my system&#8217;s <code>NLS_DATE_FORMAT<\/code> parameter (which is currently <code>DD\/MON\/RR<\/code>). We can <a href=\"https:\/\/database.guide\/how-to-change-the-date-format-in-your-oracle-session\/\" data-type=\"post\" data-id=\"19271\">change the <code>NLS_DATE_FORMAT<\/code> parameter<\/a>, or use a function like <code>TO_CHAR()<\/code> to return the result in a different format. <\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT TO_CHAR(SYSTIMESTAMP, '<meta charset=\"utf-8\">YYYY-MM-DD HH24:MI:SS TZR')\nFROM DUAL;<\/code><\/pre>\n\n\n\n<p>Result:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">2021-08-06 19:48:43 -04:00<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Calling <code>SYSTIMESTAMP<\/code> with Parentheses<\/h2>\n\n\n\n<p>As mentioned, the <code>SYSTIMESTAMP<\/code> function is called without parentheses.<\/p>\n\n\n\n<p>Here&#8217;s what happens when we call it with parentheses:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT SYSTIMESTAMP()\nFROM DUAL;<\/code><\/pre>\n\n\n\n<p>Result:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Error starting at line : 1 in command -\nSELECT SYSTIMESTAMP()\nFROM DUAL\nError at Command Line : 1 Column : 21\nError report -\nSQL Error: ORA-30088: datetime\/interval precision is out of range\n30088. 00000 -  \"datetime\/interval precision is out of range\"\n*Cause:    The specified datetime\/interval precision was not between 0 and 9.\n*Action:   Use a value between 0 and 9 for datetime\/interval precision.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In Oracle Database, the SYSTIMESTAMP function returns the system date, including fractional seconds and time zone, of the system on which the database resides. The returned value is of type&nbsp;TIMESTAMP WITH TIME ZONE.&nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[68,93,20],"class_list":["post-19331","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-date-functions","tag-functions","tag-what-is"],"_links":{"self":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/19331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/comments?post=19331"}],"version-history":[{"count":4,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/19331\/revisions"}],"predecessor-version":[{"id":19392,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/posts\/19331\/revisions\/19392"}],"wp:attachment":[{"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/media?parent=19331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/categories?post=19331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/database.guide\/wp-json\/wp\/v2\/tags?post=19331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}