Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Thursday, March 4, 2010

How to get Date in Hijrah calendar from Oracle

Hi,

NLS_CALENDAR by default is GEORGIAN in the database so it displays date in Georgian calendar but on demand if u want HIJRI date in Calendar no worries  using To_char we can achieve this


select to_char(sysdate,'fmdd month rrrr','nls_calendar=''arabic hijrah''') from dual

select to_char(sysdate,'fmdd month rrrr','nls_calendar=''english hijrah''') from dual

Output would be like
 
18 ربيع الأول    1431
18 Rabi' Awwal  1431

If we want our database to follow HIJRI calendar then NLS_CALENDAR parameter need to be change
more info about current database settings and valid values

select * from database_properties;
select * from v$nls_parameters;
select * from v$nls_valid_values;

 This tip might helps our Middle-eastern and Saudian guys :)

Regards,
ZB
http://baigsorcl.blogspot.com/

Monday, February 22, 2010

Get rid of quotes signs ' with Oracle 10g and 11g

Hi,

Recently i have posted this topic on my blog with Oracle 10 and 11g you can avoid the use of additional quotes signs when creating any Literal string ...

Like in reports it is common for us to write something similar to this

e.g  ' where hiredate between '||''''||p_from_date||''''||' and '||''''||p_to_date||''''

Click here for more info 

Now u can follow me on Twitter as well 

Have a nice day,
Baig
http://baigsorcl.blogspot.com/