Wednesday, October 31, 2007

Some videos on java

The Basics Of Java Programming
http://video.google.com/videoplay?docid=3033046715115330539

JAVA - Introduction to Java Level 1
http://video.google.com/videoplay?docid=-1303463806416818450

Getting Started with Eclipse and Java
http://video.google.com/videoplay?docid=-8333444930444310697

Java Video Tutorial 2: Hello World!
http://video.google.com/videoplay?docid=-1068182754251035803

Design Patterns in Java: tricks ans tips
http://video.google.com/videoplay?docid=-8911875981880954778


Advanced Topics in Programming Languages Series: Python Design Patterns (Part 1)
http://video.google.com/videoplay?docid=-3035093035748181693

Advanced Topics in Programming Languages Series: Python Design Patterns (part 2)
http://video.google.com/videoplay?docid=-288473283307306160

Advanced Topics in Programming Languages: A Lock-Free Hash Table
http://video.google.com/videoplay?docid=2139967204534450862

Advanced Topics in Programming Languages: The Java Memory Model
http://video.google.com/videoplay?docid=8394326369005388010

Advanced Topics In Programming Languages: Closures For Java
http://video.google.com/videoplay?docid=4051253555018153503

Java Video Tutorial 5: Object Oriented Programming
http://video.google.com/videoplay?docid=-2491773103678404043

Advanced Topics in Programming Languages: Java Puzzlers, Episode VI

http://video.google.com/videoplay?docid=9214177555401838409

Sunday, October 21, 2007

Best web sites for Oracle

Best web sites for Oracle :

www.google.com
asktom.oracle.com
metalink.oracle.com
technet.oracle.com
tahiti.oracle.com
www.hotsos.com (database performance tuning)
www.lazydba.com (this site generates a lot of email)
OracleSponge -- interesting articles, experiments. Good Materialized View info.
Rittman -- Data Warehousing and BI

PL/SQL : Log4J - for PL/SQL debugging similar to Log4J for Java

Log4J for PL/SQL
From ITWiki

We are using Log4J (other than dynamo projects) on the web app.

But to debug complex (or large) procedures / functions in pl/sql, we have been looking for a useful api, similar to Log4J.

Here we go ....

http://log4plsql.sourceforge.net/

(from the web site)

LOG4PLSQL is a PLSQL framework for logging in all PLSQL code :

Package
Procedure
Function
Trigger
PL/SQL Web application
...etc.,.

- Ability to use all LOG4J features.

Log destination:

Table in Oracle Datablase
Oracle Datablase alert.log file
Oracle Datablase trace file
Standard output

ps : Please do not attempt to install it on your own. DBA needs to install it.

Oracle 8i : Using CASE in PL/SQL on Oracle 8i

CASE statements do work on Oracle 8.1.7, but not in pl/sql.

Let us see a work around to make them work in pl/sql.

Let's see an example :

Connected to Oracle8i Enterprise Edition Release 8.1.7.4.0
Connected as idc_sage

SQL> select case when 1=1 then 1 else 2 end from dual;
CASEWHEN1=1THEN1ELSE2END
------------------------
1

Let's try the same SQL query in pl/sql :

SQL> declare
2 var number;
3 begin
4 select case when 1=1 then 1 else 2 end
5 into var
6 from dual;
7 dbms_output.put_line('var='||to_char(var));
8 end;
9 /
ORA-06550: line 4, column 16:
PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
( * - + all mod null

table avg count current distinct max min prior sql stddev sum
unique variance execute the forall time timestamp interval
date



So how do we get this working in pl/sql ?
Use
[edit]
"Execute Immediate"
.

Her you go :

Connected to Oracle8i Enterprise Edition Release 8.1.7.4.0
Connected as idc_sage

SQL> set serveroutput on
SQL> declare
2 var number;
3 sql_str varchar2(100);
4 begin
5 sql_str := 'select case when 1=1 then 1 else 2 end from dual';
6 execute immediate sql_str into var;
7 dbms_output.put_line('var='||to_char(var));
8 end;
9 /

var=1

PL/SQL procedure successfully completed
SQL>

[edit]
Voila !!!

ps : If you are working on 9i or above you will not see this issue.