Skip to main content

Posts

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....

How to Activate Apex on Oracle 11 g R1

To configure the embedded PL/SQL gateway: 1. Go to the  $ORACLE_HOME/apex  directory. 2. Use SQL/Plus to connect as SYS to 11g database where APEX is installed. SYS AS SYSDBA@db11r1> @apxconf PORT ----------8080 Enter values below for the XDB HTTP listener port and the password for the Application Express ADMIN user. Default values are in brackets [ ]. Press Enter to accept the default value. Enter a password for the ADMIN user [] admin_password Enter a port for the XDB HTTP listener [ 8080] ...changing HTTP Port PL/SQL procedure successfully completed. PL/SQL procedure successfully completed. Session altered. ...changing password for ADMIN PL/SQL procedure successfully completed. Commit complete. 3. Unlock the ANONYMOUS account. SYS AS SYSDBA@db11r1> ALTER USER ANONYMOUS ACCOUNT UNLOCK; User altered. 4. Enable Oracle XML DB HTTP server SYS AS SYSDBA@db11r1> EXEC DBMS_XDB.SETHTTPPORT(8080); PL/SQL procedure successfully comple...

Inserting values into a table with '&'

I often say "I learn something new about Oracle every day".  It really is true - there is so much to know about it, it is hard to keep up sometimes. It is a  little sqlplus quirk that I probably knew at one point but totally forgot.  People run into problems with &'s in sqlplus all of the time as sqlplus tries to substitute in for an &variable.  So, if they try to select '&hello world' from dual - they'll get: SQL> select '&hello world' from dual; Enter value for hello:  old   1: select '&hello world' from dual new   1: select ' world' from dual 'WORLD ------  world As the result. One solution is to "set define off" to disable the substitution (or set define to some other character).  Another oft quoted solution is to use  chr(38) -  SQL> select chr(38)||'hello world' from dual;   I never liked that one personally.  lol :)   What i suggest is this  SQL> select ...

How to hack Google+ to send your friends invites (At least For A Start)

Here in Africa i woke up to find Google had shut down the invitation process to Google +. So after a bit of testing I’ve found out the following how to bring your friends in to it while Google has a lock-down on the service. If you have an invite to join Google+, right click on the invite link you were sent on email and save the URL. Paste that URL to Twitter or Facebook or email it to some friends. With any luck some of them will get in via that link. I tried this by Tweeting my own invite link, and magically a few people managed to get an invite of their own. Most did not however, so this is not a full proof work-around. It seems to work if people waited a couple of minutes or refreshed the page after a minute. The better, more guaranteed hack is one or both of the following. An existing user on Google+ creates a new Circle, called (Writer or Bloggers) Invites. They then add the emails of the people they want to invite to that circle. An additional work-around – which also app...

the html5 switch...Interesting!

Depending on who you talk to, you should have been using HTML5 months, nay  years ago; or it's something you might be using in 2022. As usual the truth is somewhere between the glib extremes. There's no one-size-fits-all answer to questions of platform choice: you have to consider the benefits for your own scenario. But with HTML5 I'd say if you haven't switched yet, for most people  it's probably time - there's a form of "switching" that will work for you. Some people seem caught up on the problem that many features have very poor support across browsers; or are simply put off by the thought of redoing their entire code base. Really though, you don't have to rebuild everything, not use everything in HTML5 for it to be worthwhile  switching your doctype  now. Over the past few months I've switched  a large application  and a few small sites to run the HTML5 doctype. Most have been seamless, with just one website exploding on contact ...