Friday, November 25, 2011

TO_DATE(Date datatype) is not a date

Try this

Select TRUNC(sysdate), TO_DATE(sysdate), CASE WHEN TRUNC(sysdate) = TO_DATE(sysdate) THEN 'Equal' ELSE 'Not Equal' END from dual;

Well, I got a 'Not Equal' and I don't understand why. Both result from TRUNC and TO_DATE are looked the same but they are not equal. Theoretically, they are same data type but they're still not equal.

So, what gives?

Wednesday, November 16, 2011

2nd paper


I woke up this morning feeling nervous because finally the day has come for my second test paper  before certified as Oracle Certified Associate.

I took my breakfast and read the morning newspaper as usual. Then, before heading out to the test center, I took a second check on the address and it's a a new address for me as I never been there before. So, I went out early just to make sure I got enough time to reach there in case I took the wrong road.

Everything went well and I reached the test center much earlier than expected. I checked with the reception on my exam slot booking and after the form filling and registration, I was in the cubicle with test application on the monitor.

After all the study preparation, the test took me 30 mins to finished and finally, a big FINALLY, I have passed the test.

The first paper I've taken it was 2009 and now is 2011 only I go for the second paper. What happened in between those years? Well, it was procrastination, excuses, fear and endless of preparation. Analysis until paralysis. Anyway, it ends for now until another certification caught my eye (I got a feeling to go for the Professional Certificate) and I hope the vicious habits don't start again.

Wednesday, November 9, 2011

Use PDF rather than Microsoft Word to share document

Actually, I use 3 different OS in my daily life and they are Window XP, Ubuntu and Android. I have all 3 OS installed Microsoft Word editor and edit my resume on them. I use Dropbox to put my document online so I can easily edit and share it to recruiter. Unfortunately, all 3 editor reacts differently when I try to edit my document. The document always shows differently or gone wrong (especially on bullet paragraph) each time I open it using a different editor. I have no idea why (probably Microsoft Word makes the word document format so hard for other developer to adopt it).

Finally, I found a better way to share document by exporting them to PDF format when I'm done editing it. This way, the document format will always be the same. I know it's a hassle but it will always formatted right when user open the document.

Monday, October 3, 2011

We don't care about the software update


I and my wife was invited to a my wife friend's place for couple days. One day, they asked for my help to fix  their laptop that is running very slow lately.

The first impression on the laptop that it was the same model as mine which I bought it 4 years ago. It was running Windows XP sp2 and they told me that they have been skiping updates poping up in their screen except anti virus update. To me, I was in shocked.

I have run disk checking, defrag and disable most of the startup program and services (as requested by the husband), however the windows startup still running very slowly. Then I found out their laptop was still using 512 MB of ram. :O (mine has already upgrade to 2gb since ram is cheap nowadays)

After further investigation, then I found out it's the old version of anti virus that's hogging the memory and running startup scan each time when they log into their machine. I let the scan to finished its job and then the laptop was back to normal.

In the end, I recommended them to find a new free anti virus from the internet to replace the old one and let the husband to do the research. (which I doubt he will replace it because he wasn't that much of interest.) I didn't try to do much on the laptop because their internet connection was using 3g modem. well, that means I can't do a windows sp3 update because that's going to eat up most of their 3g data.

After all these, I suddenly realized that home user wasn't care much about updates, which in their perspective, that doesn't bring in any value. Therefore, will there be any program/OS in the future that doesn't requires updates? I highly hope so that mine wishful thinking could become a reality in future.

Sunday, July 24, 2011

TO_DATE(NULL)

Wonder why the null needs to be convert to date data type? well, here's the story.

DECODE (BIRTHDATE, TO_DATE('31129999', 'DDMMYYYY'), TO_DATE(NULL), BIRTHDATE)

Simply put, if the birthdate is equal to end of the calendar then put the output as null else show the birthdate. Unfortunately, the SQL code was not accepted because the argument type in the decode function all must the same.

Of course there nothing wrong to convert a null value but nevertheless it looked silly. :-D

Wednesday, June 1, 2011

SQL Mystery Stories

I caught this video on YouTube and it's rather interesting. The last part regarding tagging for better text searches is rather new to me because database does not have a function to search part of text if one of the word spelling is wrong.

So far it only comes with part 1. Hopefully there will part 2 soon. :)

Saturday, April 9, 2011

Oracle Express Edition 11g (beta) is here

I got the news from oracle newsletter. However, it's still in beta version for now and the previous stable 10g version still available (link below). I haven't tested it yet but will try to find the time to test it out (or perhaps wait for the stable release) and see what are the new features available.

Tuesday, March 15, 2011

XP User: Forget about Internet Explorer

I read a news from CNET (Internet Explorer 9 arrives, but not for XP) regarding IE 9 has been released and it's available to download. I also got the same news from lifehacker Internet Explorer 9 Officially Released.

What surprised me was the new browser left out XP user although there are statistic (according to cnet link) where half of the internet user still using XP (including me, at this point of time). So it bothers me why Microsoft would go for this approach where competitors (Firefox, Chrome, Safari, Opera) still supporting XP. Obviously the software giant is pushing its Windows 7 OS to XP user by claiming the new browser requires certain OS technology that can only be found in Windows Vista/7.

Well, it doesn't really hurt me that much anyway because I have stop using IE for quite some time. Even my wife, who using Window 7 starter, also stop using IE and went for Chrome.

Friday, March 4, 2011

Working on my PLSQL certification exam

I've done the first exam (SQL Fundamental 1) and now after more than a year has past, I'm working on the second paper (Prgram with PL/SQL) before I get my OCA title. Books I've bought to prepare for this paper has been collecting dust and taking them out to study again is a dragging experience. I know it has to be done (well, my wife keeps nagging me when to get the OCA title) but somehow, things just come along the way. Job changing, family's wedding plus money issue seems extends the exam period further away.

Now, I have promised my wife that I will try to get this done in this month. No more distraction and excuses. Beside that, I've downloaded the documentation from Oracle website and it seems to be less boring experience if I go back to the books I have read so far.

Well, wish me luck.

Saturday, February 26, 2011

Firefox 4 Beta 12 Testing

I worked as a QA before and no doubt, testing is part of my interest. I found out that Firefox 4 is currently on beta version testing and so I joined the crowd.

I have previously downlaoded the Firefox 4 beta 10 and the biggest turn off for me is the memory issue. It eats up about 1gb memory and slow my whole system down. So, I unistalled it and turn to Chrome instead.

Now, Firefox 4 beta 12 has fixed this memory issue and now I taking it back to the testing again. With this release, I'm quite happy with the new interface and the add-on/extension page. It feels like Firefox is back to the ring again to fight with Chrome.

Nevertheless, it's still early to tell whether Firefox will win back my confidence in it but I can see the Firefox 4 beta 12 is going the right way. I also can see that the Firefox developers are really listening to the users' feedback (I submitted the memory issue feedback back then).

Finally, it's still in Beta version and no doubt there will always some bugs pop out here and there. If it's getting to annoying, I'll just submit feedback, turn to Chrome and wait patiently for the next release. :D

How to turn on "do not track" in Firefox 4?

Go to the Option screen by click on top left corner Firefox > Options > Options. Checked the option as shown below.


What happened if those website refuse to listen (to the do not track option)? :P

Wednesday, February 23, 2011

When not to use dynamic sql?

This is just my opinion when not  to use dynamic sql.

Here, I just going to give a brief introduction on dynamic sql. Dynamic sql just is a string that consists sql statement which you manupulate based on the different condition. It can be imagined as a lego block, you can build the sql string the way you wanted. Example below.

v_sql := v_select || v_table || v_where || v_groupby;

Execute immidiate v_sql; -- sql statement will be execute here

The best way to use dynamic sql is when the condition is keep changing. Example, condition are stored in table and can be add, remove, update or delete.

So, when not to use it? The condition is predictable and fixed (duh). Example, there are maximum 6 sql queries for 6 results (one for each table). Instead of using dynamic sql, it can be divided into 6 different procedures. Remember, 6 is fixed and there is no more than that. (If this change in future, then 6 is not fixed and that's different story).

The benefits for using 6 different procedures are easy to maintain. The result are no relation to each other nor there is a table link between them. Debugging is much easier when there are no other code laying around and caused confusion. Putting them into isolated procedure is much more easily to navigate in editor. Instead of having one large dynamic string, they are divided into small code for easy to identify and locate.

In short, avoid dynamic sql if the development is small, fixed and controllable. Instead of adding complexity to simple pl/sql development, why not go for maintainbility. It saves more time in the long run by just adding couple of extra lines.

Tuesday, February 22, 2011

Trying out Oracle VirtualBox

It's originally from Sun but Oracle has bought over SUN, so it become Oracle VirtualBox. Anyway, the last time I tried on this free virtual machine, I was having trouble. The software seems to be slowed and easily crashed by then. Now I'm going back there again to check up whether it has improved over the years.

I wanted to install a database on the virtual machine so I can try out something or probably create a small project. In virtual machine, I can take snapshot and restore if I mess up the database and it will surely save time if I have to restore using database feature (something I need to spend more time to study into).

Let's see how far it wil go. :)

Update: There is a pre-built virtual machine for developer (link below). This will save a lot of time building the virtual machine from scratch. However, the file size and the download is a pain.

http://www.oracle.com/technetwork/community/developer-vm/index.html

Thursday, February 17, 2011

Off the hook on gadget article

Recently I was pretty much hooked on gadget article (surprisingly, I was less addicted to social network). It all begins when I was doing research on my wife newly bought netbook, the Samsung NF310. I wanted to check out the good or bad point about it and probably find a workaround on the bad points I can find.

Well, while doing the research I found a lot of great stuff such as the lastest phone and tablet running around in the same site with netbook reviews and this got me hooked. After tracing back the amount of time wasted I have done, I finally cut down all my gadget bookmark to 3. Yes, just 3 and they are listed below:

lifehacker.com : Not a truly a gadget site but sometimes it has some news on gadget stuff. However, it has some tutorial on learning new skill (e.g. programming, photoshop) and day 2 day life tips.

gizmodo.com : After all the gadget site I have visited, I find this site can keep me up to date with tech/gadget news overall. Furthermore, it has a nice layout that allows me to jump between article easily. So, I dump the rest and keep this one.

kotaku.com : Finally, my only gaming news source. They have very interesting article and opinion plus lots of comment. :P I may need to watch out myself on this one on how much time I have spent on the site.

3 is just nice and it kept my reading down under 1 hour. Now I have more time on doing other thing such as writing this article and pick up I what I have left off on working my Oracle study and exam. :D

Update: I switched back to reading feeds instead because it is more efficient without the ads and distraction.

Sunday, February 6, 2011

Chrome Web Store

I've just updated my Chromium in Ubuntu 10.04 and it added the Chrome Web Store. I went to the site and installed couple of apps and on the first look, I'm really impressed. I have in installed the ScribeFire (used for writing this post) and Quick Note (for storing notes) and I like them both. I also tried out the Entanglement game which seems fun (puzzle game).
Then it pops into my mind that I have the Tomboy notes installed as my desktop apps for me to taking down notes. For unknown reason, I uninstalled the desktop app and move to Quick Notes. Probably my current disk space is low and furthermore, I just want to check out how the Quick Note performs for couple of days/weeks.
Well, if you're using Chrome/Chromium, do check out the Chrome Web Store because there are a lot goodies there. :)

Update: I switched back to Tomboy notes because I can use it without having to open Chromium. I can straight away create a new note (Tomboy is set on startup) with keyboard short cut without going online. :P

Tuesday, January 25, 2011

Debugging SQL script caused by data error or missing

Short version:
1. Check which table that cause the data missing by comment all table in the script and re-enable the table one by one, along with the table's filter (where clause).
2. After the table has been found where the data start missing, then only narrow down which filter that caused the data missing.

Long version:

I got a bug repot from analyst and it goes something like below.

"The report does not shows any result although it just recently changed on the fields. No logic or filter has changed so far. Please investigate."

When I open the SQL script, my jaw dropped because it was a very long script. I lost my count only how many line were there. There are 2 SQL union all together and thus it's not something easy to debug.

The dumb way: I tried to comment the filter one by one and see which one make the result appear back again. Then I realize that this approach is very time consuming. Each time execute the script to check the result, it will take a long time due to large table.

The smart way: I changed my approach by going after the table. Comment all the table and re-enable them one by one. Once result start to appear/missing after table is disable/enable (along with its filter) will shows most probably the problem lies on the filter for this table. Well after couple of tries, finally I found what caused the data to be missing from the report (It's a function that used for that specific table field and somehow the data does not match).

In the end, one more support ticket has been solved. :P