Monday, April 17, 2006

A great tip ^M

Today I spent a while fixing the famous ^M problem when copying file from DOS to Unix.

Find two solutions:
1. Use dos2unix command can convert a dos file to unix format (removing annoying ^M)
2. Since originally the dos files are introduced through CVS checkin. If I change the the file type from "binary" to "ASCII" in eclipse. CVS will figure out the file format and automatically remove ^M for me.

One note:
If you open a dos file using vi in Unix environment. vi won't show ^M for you since vi will open the file as dos format. I didn't know this initially.

Thursday, April 06, 2006

Still about oracle time

Oracle time setup is complicated: You have following choices to retrieve timezone and time info:

select to_char(sysdate,'YYYY-MM-DD HH:MI') from dual;
select dbtimezone from dual;
select current_timestamp from dual;
select sessiontimezone from dual;
select systimestamp from dual;

One strange one I encountered today is while I am using the oracle advanced queue (AQ). There are columns named ENQ_TIME and TIME_MANAGER_INFO. Both are autogenerated fields. For ENQ_TIME, oracle use the timezone time (local time); for TIME_MANAGER_INFO, oracle use GMT time! Strange

Monday, April 03, 2006

Oracle reference.

I always forget Oracle's way of retriving the current timestamp.

"select sysdate from dual;"

Next time I can come here to look it up.

Also a very useful oracle reference: