Friday, February 22, 2008

It's the Initiation that matters...

Taking Initiation has always been my biggest problem. Because once I get started I put lot of effort and dedication into it to get it done and to do it in a nice way. But starting it is the biggest problem. By “It” I mean any thing and every thing.

Take it to read some thing may be a book or to do a presentation or getting my ideas into execution. I always find it difficult to get that initial inspiration. Once it is there it’s always like sky is the limit. It starts to flow and I love it. I guess lots of people go through that state. Not sure if they do.

Tuesday, February 19, 2008

Ask Tom

Ask tom (http://asktom.oracle.com) is a great place for oracle developers and DBA. You have so much in there. I would say it’s a repository of Knowledge about Oracle and in general Database.

Today I wanted to write a small utility to export data from a table and put into a csv file. I just searched and got this great stuff from Ask Tom.

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:68212348056

Dump_CSV is what all I wanted. Got it modified little bit to support my requirements. And in no time I was ready.

In ask tom you not only get answers for your questions but also lot of alternatives. What is the best way to approach the problem and lot more?

Tuesday, February 12, 2008

Why do we need to follow coding standerds?

Why do we need to follow coding standerds? Over a period of time i have been tought to follow certain coding standards. Mainly like

Local variable - Starts with l

Global variables - Starts with g
Parameter - Starts with p

and so on...

Are these standards just to make our code look beautiful or are thes things our life savers. lets see a small example....

sql> create table hx_tmp(hx_val INTEGER);
Table created.

sql> insert into hx_tmp values (1);
1 row created.

sql> insert into hx_tmp values (2);
1 row created.

sql> commit;
Commit complete.

sql> create or replace function hx_f (hx_val in integer) return integer
2 as
3 hx_out INTEGER := 0;
4 begin
5 select hx_val into hx_out from hx_tmp where hx_val = hx_val;
6
7 return hx_out;
8 end;
9 /
Function created.

sql> variable a number

sql> exec :a := hx_f(2);
BEGIN :a := hx_f(2); END;
*
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "SYSADM.HX_F", line 5
ORA-06512: at line 1

Oooooops.....

If you where expecting to get a result think again. This is all because i dint follow the coding standard that i was supposed to follow. So i was expecting that input value 2 will be passed to the SQL. But it did the other way. Its all because of bad way of coding.

So conclution....

Coding standards is not just to make your code look beautiful or understandable or maintanable or.... or..... or.... but also to make your code bug free.

Monday, February 11, 2008

Dynamic data modal sucks…

Dynamic data modal sucks…

I have always felt this. But people keep on asking for this.

Dynamic data model…
Unknown number of columns in a table…
Store rows as columns…
Store column as rows…
Take transpose…
Do all sort of nonsense…

The outcome that I have found because of this is simple.

Headache wile coding…
Big headache wile debugging…
Bigger headache wile tuning for performance…

But people still want it and people still do it…