Skip to content
Keep Learning Keep Living
Keep Learning Keep Living
Keep Learning Keep Living

Month: July 2020

Timestamp Arithmetic and Well Known Mistakes

Mustafa, 2020-07-28

Hi, Lately, I started to see many developer uses timestamp types (like timestamp or timestamp with time zone) wrong especially in time arithmetic. So as a short reminder, adding and subtracting numbers to/from a DATE value will add/subtract number of days:

1
2
3
4
5
6
7
8
9
10
11
12
Select Sysdate "TODAY",
       Sysdate + 1 "TOMORROW", --add 1 day
       Sysdate - 1 "YESTERDAY", --subtract 1 day
       Sysdate + (1/24) "ONE HOUR LATER", -- add one - twenty forth day, since a day has 24 hours, it adds 1 hour
       Sysdate - (1/24) "ONE HOUR BEFORE", -- remove 1 hour
       Sysdate + (1/(24*60)) "ONE MINUTE LATER", -- add 1 minute, also 24*60=1440 is used frequently
       Sysdate + (1/(24*60*60)) "ONE SECOND LATER" -- add 1 second, also 24*60*60=86400 is used frequently
From   Dual;
 
TODAY               TOMORROW            YESTERDAY           ONE HOUR LATER      ONE HOUR BEFORE     ONE MINUTE LATER   ONE SECOND LATER
------------------- ------------------- ------------------- ------------------- ------------------- ------------------- -------------------
2020-07-28 14:07:38 2020-07-29 14:07:38 2020-07-27 14:07:38 2020-07-28 15:07:38 2020-07-28 13:07:38 2020-07-28 14:08:38 2020-07-28 14:07:39

Basically that is all if you use add…

Continue Reading

Frequent and Fast Refresh Materialized Views has a Big Problem!

Mustafa, 2020-07-252020-07-25

Hi, While I was checking V$SQL_PLAN view for a whole different reason, I realized that some of the cursors has incredibly high child cursors. I started to dig and finally I find the problem. My customer have a few frequently fast refreshed materialized views. One of them is refreshed every…

Continue Reading

CSV Data in Clob to Columns Using Select

Mustafa, 2020-07-142020-07-14

Hi, Thanks to one of my customers, I am dealing with csv data in clob lately a lot. so they asked me if I can get a csv data in a clob column as separated columns using select statement. They wanted to show this data on their applicaitons. I suggested…

Continue Reading

Is It Possible to Change SQL Statement in the Database?

Mustafa, 2020-07-042020-07-04

YES! Hi, today I want to write about something which has been asked for many times to me. Let’s say you have an application and it is running very poorly designed sql statements in your database and you are really bored having fights with development teams to ask a change…

Continue Reading

V$SqlStats vs V$SqlStats_Plan_Hash, different columns?

Mustafa, 2020-07-012020-07-01

Hi there, V$SQLSTATSis a beautiful view for information about sql statements. you might say v$sql has that information too which is correct but V$SQLSTATSis much more faster than v$sql and keeps data about sql statements for a longer time than v$sql. https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/V-SQLSTATS.html However, the V$SQLSTATS view differs from V$SQL and V$SQLAREA in that it is faster,…

Continue Reading

Recent Posts

  • Sessions with details
  • DBMS_PIPE Connecting the Sessions
  • DBCA Templates and Dangerous “General Purpose” Template
  • NON-CDB to PDB Migration Horror
  • 23c is Finally Here!
  • Not Deploying is also Important!
  • Damaged rowid is referenced! Health Monitor
  • Old Obsolete Backup is not Deleted

Recent Comments

  • Mustafa on DBMS_PIPE Connecting the Sessions
  • Hemant K Chitale on DBMS_PIPE Connecting the Sessions
  • Mustafa on DBMS_PIPE Connecting the Sessions
  • Hemant K Chitale on DBMS_PIPE Connecting the Sessions
  • Phong on ORA-00942: table or view does not exist and sequences as default value

Categories

  • 11g
  • 12c
  • 18c
  • 19c
  • 21c
  • 23c
  • Administration
  • Compression
  • Development
  • Materialized View
  • Multi-tenant
  • Performance
  • Security
  • SQL / PLSQL
  • Uncategorized
  • Undocumented
  • Useful Scripts

Archives

  • September 2023
  • August 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • October 2021
  • September 2021
  • August 2021
  • April 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • July 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • June 2018

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

RSS Follow This Blog

  • Sessions with details
  • DBMS_PIPE Connecting the Sessions
  • DBCA Templates and Dangerous “General Purpose” Template
  • NON-CDB to PDB Migration Horror
  • 23c is Finally Here!
  • Not Deploying is also Important!
  • Damaged rowid is referenced! Health Monitor
  • Old Obsolete Backup is not Deleted
  • Autoupgrade doesn’t Upgrade Timezone Version While RU Patching
  • Unique Columns For V$Sql

Archives

  • September 2023
  • August 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • October 2021
  • September 2021
  • August 2021
  • April 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • July 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • June 2018

RSS Follow This Blog

  • Sessions with details
  • DBMS_PIPE Connecting the Sessions
  • DBCA Templates and Dangerous “General Purpose” Template
  • NON-CDB to PDB Migration Horror
  • 23c is Finally Here!
  • Not Deploying is also Important!
  • Damaged rowid is referenced! Health Monitor
  • Old Obsolete Backup is not Deleted
  • Autoupgrade doesn’t Upgrade Timezone Version While RU Patching
  • Unique Columns For V$Sql
RSS Error: A feed could not be found at `http://www.mywebsite.com/feed/`; the status code is `200` and content-type is `text/html; charset="utf-8"`
©2023 Keep Learning Keep Living | WordPress Theme by SuperbThemes