Archive for July, 2008

Sql*plus doesn’t commit at end or does it?!?

July 29th, 2008

A collegue of mine had to debug all his code, twice, to try to find why one of his tables wasn’t populated.
Here is why: He asked to execute a script (script didn’t contained a commit statement) in sql*plus at someone of the production team. That guy opened sql*plus, executed the script and closed window (File>Exit) [...]

Nostalgy

July 29th, 2008

I found a pdf that contained the SQL reference manuel of Oracle 7, you remember?
Pure nostalgic document that probably everybody had laying on their desk or drawer.
Here it is: Oracle v7 sql_reference

To block sample or to auto sample? That’s the question !

July 23rd, 2008

Because of some problems with the Oracle statistics I did a small research.
I have a custom procedure of gathering stats that i call p_x_stats_table. It will gather stats with and estimation of X% of the records. With X corresponding a percentage witch reflect 100.000 records (or all records of table if amount of records inferiuor then [...]

Interesting system views concerning statistics history

July 23rd, 2008

WRI$_OPTSTAT_HISTGRM_HISTORY
WRI$_OPTSTAT_HISTHEAD_HISTORY
WRI$_OPSTAT_TAB_HISTORY

OBIEE + MS Cubes

July 15th, 2008

There is a good article (written by Marc Rittman) that’s explains how to finally get OBIEE and MS cubes work together.
The most important paragraph is:
Getting XML/A working with Microsoft Analysis Services 2000 is a bit tricky as you’ve got to download the Microsoft XML For Analysis SDK from Microsoft Technet, upgrade Analysis Services to Service [...]

Faster, commit!

July 9th, 2008

In Oracle 10gR2 there is a way to make a commit even faster in your PL/SQL code. Hey every microsecond counts.

COMMIT WRITE IMMEDIATE NOWAIT;

How to execute long dynamic statements

July 7th, 2008

PROCEDURE exec_clob_sql_statement(vv_clob_sql_statement IN clob) IS
v_cur       INTEGER     := DBMS_SQL.open_cursor;
v_offset    PLS_INTEGER :=1;
v_nb        PLS_INTEGER :=0;
v_sql_table DBMS_SQL.varchar2a;
v_len       PLS_INTEGER;
v_retval    INTEGER;
BEGIN
  v_len := DBMS_LOB.getlength(vv_clob_sql_statement);
 
LOOP
    v_nb:=v_nb+1;
    v_sql_table(v_nb):=DBMS_LOB.SUBSTR(vv_clob_sql_statement
                                        ,LEAST(4000,v_len - v_offset + 1)
                                        ,v_offset
                                        );
    v_offset:=v_offset + 4000;
    EXIT WHEN v_offset > v_len;
  END LOOP;
 
DBMS_SQL.parse(v_cur, v_sql_table, 1, v_nb, FALSE, DBMS_SQL.native);
  v_retval:=DBMS_SQL.EXECUTE(v_cur);
  DBMS_SQL.close_cursor(v_cur);
EXCEPTION WHEN OTHERS THEN
  IF DBMS_SQL.is_open(v_cur) THEN DBMS_SQL.close_cursor(v_cur); END IF;
  RAISE;
END exec_clob_sql_statement;