Skip to main content

Posts

Showing posts from April, 2012

How does one add a day/hour/minute/second to a date value?

DATE is the datatype that we are all familiar  with when we think about representing date and time values. It has the ability to store the month, day, year, century, hours, minutes, and seconds. It is typically good for representing data for when something has happened or should happen in the future.  The problem with the DATE datatype is its' granularity  when trying to determine a time interval between two events when the events happen within a second of each other. This issue is solved with the TIMESTAMP datatype. In order to represent the date stored in a more readable format, the TO_CHAR function has traditionally been wrapped around the date: SQL> SELECT  TO_CHAR(hiredate,'DD.MM.YYYY:HH24:MI:SS')  "hiredate"   FROM employees; hiredate ------------------- 17.12.1980:00:00:00 20.02.1981:00:00:00 The SYSDATE pseudo-column shows the current system date and time. Adding 1 to SYSDATE will advance the date by 1 day. Use fractions to add hours...

The Essentials of the (+) in oracle 11g

the  (+)  syntax is obsolete, proprietary syntax that Oracle used for years to accomplish the same results as an  OUTER JOIN . I assume they adopted their proprietary syntax before SQL-92 decided on the standard syntax. Using standard SQL  OUTER JOIN  syntax (which is now supported by all major RDBMS implementations) would be the following example : SELECT     Table1 . Category1 ,     Table1 . Category2 ,     COUNT (*) AS Total ,     COUNT ( Table2 . Stat ) AS Stat FROM Table1   LEFT OUTER JOIN Table2 ON ( Table1 . PrimaryKey = Table2 . ForeignKey ) GROUP BY Table1 . Category1 , Table1 . Category2 ; Which basically means - All rows from  Table1  are included in the query result. Where there are matching rows in  Table2 , include those rows (repeating content from  Table1  if there are multiple matching rows in  Table2 ). Where there are no matching rows ...

Change default (first) page in APEX

Having seen this question often (yesterday again in the   OTN APEX forum ) and having had the same problem when I first started with APEX, I thought to blog about it. When you make your first application in APEX you typically have as default page 1 or the login page (101). If you want to change your default (first) page you need to have a look at three different places. Let's say we want to have page 9 as default page: 1)  Application Builder > Your Application > Page 101 > Processes (Page Processing) > Login Change Process to: wwv_flow_custom_auth_std.login( P_UNAME => :P101_USERNAME, P_PASSWORD => :P101_PASSWORD, P_SESSION_ID => v('APP_SESSION'), P_FLOW_PAGE => :APP_ID||':9' ); Whenever somebody logs in we want him to go to page 9. 2)  Shared Components > Security > Authentication Schemes > Your Authentication Change the Logout URL: wwv_flow_custom_auth_std.logout?p_this_flow=&APP_ID....