Wednesday, April 27, 2011

Problem in session Handling

Many of you might have faced this problem earlier as well. But this is a very new and recent learning which I have gained during my work at Nucleus Software. 

Many times I have seen, that where i expect the web-application to pick up and already existing session, it is creating a new session, when a request.getSession() is encountered.
I was unable to understand the reason, why? Then one colleague of mine helped me solve this problem. 
Still I am not 100% sure of the root cause of the problem, but this trick has solved my problem

Advanced Privacy Settings

You can override automatic cookie handling for all Web sites in the Internet zone by clickingAdvanced on the Privacy tab. You can use the Advanced Privacy Settings dialog box to configure first-party and third-party cookies to AcceptBlock, or Prompt, with a check box to always allow session cookies. 

After doing this, session.isNew() started returning false and the problem was solved. 

Tuesday, April 19, 2011

What do you think of the following query?

What do you think of the following query?

select keyword from v$reserved_words;

Sunday, April 10, 2011

to_char and to_date function in oracle

Source :

When a DATE value is displayed, Oracle must first convert that value from the special internal format to a printable string. The conversion is done by a function TO_CHAR, according to a DATE format. Oracle's default format for DATE is "DD-MON-YY". Therefore, when you issue the query
select b from x;

you will see something like:

Whenever a DATE value is displayed, Oracle will call TO_CHAR automatically with the default DATE format. However, you may override the default behavior by calling TO_CHAR explicitly with your own DATE format. For example,

returns the result:
The general usage of TO_CHAR is:
TO_CHAR(, '')

where the  string can be formed from over 40 options. Some of the more popular ones include:
  , for example.

MMNumeric month (e.g.07)
MONAbbreviated month name (e.g.JUL)
MONTHFull month name (e.g.JULY)
DDDay of month (e.g.24)
DYAbbreviated name of day (e.g.FRI)
YYYY4-digit year (e.g.1998)
YYLast 2 digits of the year (e.g.98)
RRLike YY, but the two digits are ``rounded'' to a year in the range 1950 to 2049. Thus, 06 is considered 2006 instead of 1906
AM (or PM)Meridian indicator
HHHour of day (1-12)
HH24Hour of day (0-23)
MIMinute (0-59)
SSSecond (0-59)