msgbartop
News, views, tips and tricks on Oracle and other fun stuff
msgbarbottom

links for 2006-06-30

Filed in Interesting Stuff with 2 Comments | Tags:


Go ahead, turn your FIPS flagging on

Since my last post about the undocumented pragmas in Oracle, I have found more information about the FIPSFLAG pragma directive and more specifically about the FIPS part of it. Jens commented about the existence of a session parameter FLAGGER and its possible relationship with FIPSFLAG and FIPS. After a bit of searching, here is what I found: (more…)

Filed in Oracle with Comments Off | Tags: , ,


How The Oracle Database Processes SQL Statements

The Oracle Database Concepts is a great resource not only if you are just getting started with Oracle, but also if you are an experienced Oracle professional and looking to review the basic concepts that are often forgotten or hidden behind more complex topics. The foundation of complexity is simplicity.

While researching a topic related to FIPS (that I’ll blog about soon), I came across this simple but fundamental concept in non other than the Oracle Database Concepts manual: SQL statement execution. The following is a summary of how Oracle processes SQL statements. First the flowchart followed by a brief explanation of each step. (more…)

Filed in Oracle, Tips with 1 Comment | Tags: , ,


Oracle is Female Oriented, Adobe is Male Oriented

According to Microsoft’s new adCenter Labs Demographics Prediction tool that enables you to “predict a customer’s age, gender, and other demographic information”, Oracle.com is female oriented with following confidence: 64% female and 36% male. (more…)

Filed in ColdFusion, Oracle with 2 Comments | Tags: ,


links for 2006-06-22

Filed in Interesting Stuff with Comments Off | Tags:


One more reason to upgrade your Oracle 8i

On my Oracle database 8i (8.1.7.4) instance, I ran the following:

SQL> SELECT 1 my_number
  2    FROM DUAL
  3  UNION
  4  SELECT NULL my_number
  5    FROM DUAL
  6  /
SELECT 1 my_number
       *
ERROR at line 1:
ORA-01790: expression must have same datatype as corresponding expression


SQL> SELECT SYSDATE my_date
  2    FROM DUAL
  3  UNION
  4  SELECT NULL my_date
  5    FROM DUAL
  6  /
SELECT SYSDATE my_date
       *
ERROR at line 1:
ORA-01790: expression must have same datatype as corresponding expression

What’s up with the ORA-01790 error?

As you know, NULL doesn’t have a data type, and NULL can be used in place of a value of any data type. If you purposely select NULL as a column value in a union query, Oracle no longer has two datatypes to compare to see whether the union queries are compatible. As you can see from the above queries, this is an issue for the DATE and NUMBER datatypes in Oracle 8i . However, Oracle does not have a problem with character datatypes:

SQL> SELECT 'C' my_char
  2    FROM DUAL
  3  UNION
  4  SELECT NULL my_char
  5    FROM DUAL
  6  /

M
-
C

To solve this issue, you have two options:

Option 1: Explicitly convert NULL to the right datatype:

SQL> SELECT 1 my_number
  2    FROM DUAL
  3  UNION
  4  SELECT TO_NUMBER (NULL) my_number
  5    FROM DUAL
  6  /

 MY_NUMBER
----------
         1


SQL> SELECT SYSDATE my_date
  2    FROM DUAL
  3  UNION
  4  SELECT TO_DATE (NULL) my_date
  5    FROM DUAL
  6  /

MY_DATE
---------
15-JUN-06

Option 2: Upgrade your Oracle database to 9i or above. Oracle 9i, and later releases, are “smart enough” to know which flavor of NULL to use. I executed the following in 9.2.0.6:

SQL> SELECT 1 my_number
  2    FROM DUAL
  3  UNION
  4  SELECT NULL my_number
  5    FROM DUAL
  6  /

 MY_NUMBER
----------
         1


SQL> SELECT SYSDATE my_date
  2    FROM DUAL
  3  UNION
  4  SELECT NULL my_date
  5    FROM DUAL
  6  /

MY_DATE
---------
15-JUN-06

Go for option 2, if you have not done so already.

Filed in Oracle, Tips with 2 Comments | Tags: ,


Now I know

Thank you all for your answers to my question What’s so special about the world cup?. Here is a summary of the comments:

  • Geeks watch the world cup via telnet.
  • When you watch a match, you don’t watch just two teams playing, you watch two nations.
  • The World Cup gives the only possibility where the “poor” nation can win over the “rich” one.
  • People forget their problems for a month.
  • The World Cup/soccer is something that’s in my blood.
  • There are few set plays or restrictions so every game, every moment of every game is a little different.
  • It’s the 85 minutes of rubbish play that make the beautiful moments all the more beautiful.
  • He couldn’t decide if he was a soccer nut or a geek.
  • Anyone can pick up a round ball and kick it in a general direction.
  • It has become extremely popular with everyone around the world mostly because of ease.
  • I guess it’s one of the best examples of the KISS rule ever.
  • The good thing about the World Cup is that the roads are less crowded, because people go home early!
Filed in Interesting Stuff with 5 Comments | Tags:


What’s so special about the world cup?

I do not watch or follow the world cup games – or any other “ball” games for this matter. I could care less who wins or loses. But I guess, I’m just a minority. Maybe because I’m a geek, and geeks don’t care about sports. But I know many geeks who do care about sports. Don’t get me wrong, I do take care of my health, eat right and exercise (well, I need to work harder on the last one). I just do not find it “fun” to watch sports. It’s a complete waste of my time. This is just how I see it.

So, world cup fans, help me understand, what’s so special about watching a few people kicking a ball back and forth? What is it that makes you so enthusiastic about soccer and the world cup? Is it your national pride? Is it because you want to see your team (country) winning? Or is it just for fun?

Filed in Interesting Stuff with 8 Comments | Tags:


Cool SQL Analytic Function: RATIO_TO_REPORT

RATIO_TO_REPORT is a very handy and useful function. Before going through what it does, let’s first look at this example:

SELECT   last_name, salary,
         ROUND (salary / SUM (salary) OVER () * 100,
                2
               ) percent_of_total
    FROM employees
   WHERE job_id = 'PU_CLERK'
ORDER BY last_name;

Returns:

        LAST_NAME           SALARY              PERCENT_OF_TOTAL            
------------------------- ---------- -------------------------------------- 
Baida                           2900                                  20.86 
Colmenares                      2500                                  17.99 
Himuro                          2600                                  18.71 
Khoo                            3100                                   22.3 
Tobias                          2800                                  20.14 

5 row(s) retrieved

The percent_of_total column represents the salary for each employee as a percentage of the total salary paid to all clerks. The above query can also be re-written using the RATIO_TO_REPORT SQL function:

SELECT   last_name, salary,
         ROUND
            (ratio_to_report (salary) OVER () * 100,
             2
            ) AS percent_of_total
    FROM employees
   WHERE job_id = 'PU_CLERK'
ORDER BY last_name

Both queries return the same output.

Oracle documentation definition: The RATIO_TO_REPORT function computes the ratio of a value to the sum of a set of values. Its syntax is:

RATIO_TO_REPORT ( expr ) OVER ( [query_partition_clause] )

In this, the following applies:

  • expr can be any valid expression involving column references or aggregates.

  • The PARTITION BY clause defines the groups on which the RATIO_TO_REPORT function is to be computed. If the PARTITION BY clause is absent, then the function is computed over the whole query result set.

Finally, Tom Kyte used the RATIO_TO_REPORT function to calculate the percentage of each browser hitting his blog and to calculate the percentage of his posts per month. Sergio Leunissen used the RATIO_TO_REPORT function as a basis for an APEX (HTML DB) report.

SQL Analytic functions are simple and powerful.

Filed in Oracle, Tips with 4 Comments | Tags: , ,


Oracle’s Average Acquisition Rate is 1.11 per Month

Since January 2005, Oracle has made 20 acquisitions. That’s about 1.11 acquisition per month on average, totalling $19.7 billion. Wow!

Here is the list in chronological order:

  1. 2005 – January: PeopleSoft – enterprise management software. $11.1 billion.

  2. 2005 – March: Oblix – identity management solutions. Undisclosed price.

  3. 2005 – April: Retek – retailing software solutions. $701 million.

  4. 2005 – June: TripleHop – context-sensitive enterprise search technology. Undisclosed price.

  5. 2005 – June: TimesTen – real-time data management software. Undisclosed price.

  6. 2005 – July: ProfitLogic – retailing software solutions. Undisclosed price.

  7. 2005 – July: Context Media – enterprise content integration software. Undisclosed price.

  8. 2005 – August: i-flex – banking software and services. $117 million.

  9. 2005 – September: G-Log – logistics management software. Undisclosed price.

  10. 2005 – October: Innobase – open source database technology. Undisclosed price.

  11. 2005 – November: Thor Technologies – enterprise-wide user provisioning solutions. Undisclosed price.

  12. 2005 – November: OctetString – virtual directory solutions. Undisclosed price.

  13. 2005 – December: TempoSoft – workforce management software. Undisclosed price.

  14. 2006 – January: 360Commerce – supply chain management software. Undisclosed price.

  15. 2006 – January: Siebel – customer relationship management software. $6.1 billion.

  16. 2006 – February: Sleepycat – open source database software. Undisclosed price.

  17. 2006 – February: HotSip – communications infrastructure software. Undisclosed price.

  18. 2006 – April: Portal Software – billing and revenue management solution. $220 million (transaction not yet closed).

  19. 2006 – April: Net4Call – service delivery software. Undisclosed price.

  20. 2006 – June: Demantra – demand-driven planning solutions. Undisclosed price (transaction not yet closed).

Who’s next? Only Larry knows.

Sources:
Oracle.com
MercuryNews.com

Filed in Oracle, Technology with Comments Off | Tags: