Nls_calendar='Arabic Hijrah'
Hi All,
Is any one using nls_calendar='Arabic Hijrah'? Its working fine but the only problem that we are facing is, oracle shows arabic date which is exactly less than one day of arabic date. i.e. if arabic data is 14th, oracle shows 13th. Any one have idea about this? I heard the same problem from so many people, is there any solution for this.
thanks in advance
Arabic Hijrah Calendar - FAQ
CONTENTS
1.How to set Calendar to "Arabic Hijrah" ?
2.How to display both Hijrah and Gregorian dates in the same select statement?
3.What is Calendar Deviation?
4.How to set deviation?
5. Adding ONE day in the lxecal.nlt gives TWO days added. How to workaround?
Questions & Answers
1.How to set Calendar to "Arabic Hijrah" ?
Answer
Set NLS_CALENDAR parameter in one of the following ways:
1. In the Current session :
SQL> alter session set NLS_CALENDAR="Arabic Hijrah" ;
2. All applications for a specific client:
Set NLS_CALENDAR Variable in client OS environment.
<e.g: On NT: set variable in the registry
On Unix: set UNIX environment variable in .profile/.cshrc>
3. Within SQL function:
SQL> select to_char(sysdate,'day dd month yyyy','nls_calendar=''arabic hijrah''')
from dual ;
References
Note 30772.1 Init.ora Parameter "NLS_CALENDAR" Reference Note
2.How to display both Hijrah and Gregorian dates in the same select statement?
Answer
select
to_char(sysdate,'day dd month yyyy','nls_calendar=''Arabic Hijrah'''),
to_char(sysdate,'day dd month yyyy','nls_calendar=''English Hijrah'''),
to_char(sysdate,'day dd month yyyy','nls_calendar=''gregorian''')
from dual ;
to make things a bit more clear:
alter session set nls_calendar = 'Arabic Hijrah';
gives the names of the Hijrah months in Arabic
so you client needs to be configured to display Arabic. -> Note 179133.1
alter session set nls_calendar = 'English Hijrah';
gives the names of the Hijrah months in english.
alter session set nls_calendar = 'gregorian';
gives the names of the Gregorian months (jan-feb-etc).
If you want the names of the Gregorian months in Arabic then please
see Note 264280.1 Incorrect NLS_DATE_LANGUAGE for Arabian Countries
References
Bug 1302683
3.What is Calendar Deviation?
Answer
Since Hijrah month is based on the moon complete revolution around the sun, Hijrah
Calendar has different number of days in a year than Gregorian; therefore some manual
deviation adjustement might be needed for the conversion to/from Gregorian. In other
words HIJRAH calendar is Lunar based, corrections need to be made every so often.
Note 130551.1 Conversion Algorithm of Gregorian Date to Arabic (Hijra) Date
4.How to set deviation?
Answer
1. Shutdown the database
2. Edit/create lxecal.nlt (lxecal.dat in Oracle7) in
for Oracle 8 up to 9i $ORACLE_HOME/ocommon/nls
for Oracle 10g and up $ORACLE_HOME/nls
In 8i and 9i you a example file in the 'demo' directory $ORACLE_HOME/ocommon/nls/demo
In 10g this demo file is not shipped, you can simply create on or copy the demo file from
a 9i or 8i installation.
This example makes the known adjustments needed between Gregorian
years 2000 and 2004:
DEFINE calendar
calendar_name = "Arabic Hijrah"
deviation_data = {
<"MAY-05-2000 ad">:1
<"AUG-30-2000 ad">:1
<"NOV-26-2000 ad">:11
<"JAN-25-2001 ad">:11
<"Feb-24-2001 ad">:1
<"MAR-25-2001 ad">:11
<"JUN-22-2001 ad">:1
<"JUL-21-2001 ad">:11
<"AUG-20-2001 ad">:1
<"OCT-17-2001 ad">:1
<"NOV-15-2001 ad">:11
<"JAN-14-2002 ad">:11
<"FEB-13-2002 ad">:1
<"MAR-14-2002 ad">:11
<"OCT-07-2002 ad">:1
<"NOV-05-2002 ad">:11
<"DEC-05-2002 ad">:1
<"JAN-03-2003 ad">:11
<"FEB-02-2003 ad">:1
<"JUN-30-2003 ad">:11
<"JUL-30-2003 ad">:1
<"AUG-28-2003 ad">:11
<"SEP-27-2003 ad">:1
<"JUN-18-2004 ad">:11
<"JUL-18-2004 ad">:1
<"AUG-16-2004 ad">:11
<"SEP-15-2004 ad">:1
<"OCT-14-2004 ad">:11
ENDDEFINE calendar_deviation
ENDDEFINE calendar
Notes: * Gregorian date specified in the deviation should correspond to one of
29th, 30th or 31th days of the hijrah calendar.
* Numbers greater than 10 are used to subtract days, e.g:
11 --> subtract one day, 12 --> subtract two days ...etc
3. Run the NLS Calendar Utility lxegen to register your modification to Oracle calendar
system, this utility generates lxecalah.nlb file in the same directory mentioned above.
4. startup the database.
If you want to substract dates, please also see to
Bug 2215017 SUBTRACTING DAYS FROM ARABIC HIJRA DATE DOES NOT WORK
For 9i this bug is logged:
Bug 2749165 NOT ABLE TO ADJUST THE HIJRAH CALENDAR ANYMORE IN 9.X
You need Patch 9204 or higher to be able to adjust the calendar.
There are also these backports:
windows NT/2000 9.2.0.3 Patch2. / patch set nr 2973634
HP-UX 64 bit 9.2.0.3 / Patch nr 2749165
This is also fixed in 10g and up
5. Adding ONE day in the lxecal.nlt gives TWO days added. How to workaround?
Answer
SQL> alter session set nls_calendar = 'Gregorian';
SQL> select d from d;
D
07/06/05
08/06/05
SQL> alter session set nls_calendar = 'English Hijrah';
SQL> select d from d;
D
29 Rabi' Thani 1426
01 Jamada El Oula 1426
07/06/05 needs to be 30 Rabi' Thani 1426
so you add this to the lxecal.nlt
DEFINE calendar
calendar_name = "English Hijrah"
DEFINE calendar_deviation
deviation_data = {
<"Jun-07-2005 ad">:1
ENDDEFINE calendar_deviation
ENDDEFINE calendar
and run lxegen
SQL> select d from d;
D
01 Jamada El Oula 1426
02 Jamada El Oula 1426
* the date is now 2 days further!!! this is due rounding problems in the algorithm
used for the calendar conversion a workaround is to substract FIRST one day in lxecal.nlt
DEFINE calendar
calendar_name = "English Hijrah"
DEFINE calendar_deviation
deviation_data = {
<"Jun-07-2005 ad">:11
<"Jun-07-2005 ad">:1
ENDDEFINE calendar_deviation
ENDDEFINE calendar
and run lxegen, this gives:
SQL> select d from d;
D
30 Rabi' Thani 1426
01 Jamada El Oula 1426
make sure that you substract first (= ":11") and then add (= ":1")
in the lxecal.nlt for the date
References
Oracle8i National Language Support Guide
these 2 bugs, both closed as "not a bug":
Bug 583924 NLS:HIJRAH CALENDAR DEVIATION DOES NOT WORK PROPERLY
Bug 2215017 SUBTRACTING DAYS FROM ARABIC HIJRA DATE DOES NOT WORK
Bug 2964132 TO_DATE GIVES ORA-01841 WITH HIJRAH CALENDAR
will be fixed in 10gR2
Note 130551.1 Conversion Algorithm of Gregorian Date to Arabic (Hijra) Date
Note 264280.1 Incorrect NLS_DATE_LANGUAGE for Arabian Countries
http://www.math.nus.edu.sg/aslaksen/calendar/islamic.html
The Umm al-Qura Calendar of Saudi Arabia
http://www.phys.uu.nl/~vgent/islam/mecca/ummalqura.htm
Note 241047.1 The Priority of NLS Parameters Explained.
Note 158577.1 NLS_LANG Explained (How does Client-Server Character Conversion Work?)
Note 179133.1 The correct NLS_LANG in a Windows Environment
For further NLS / Globalization information you may start here:
Note 267942.1 Globalization Technology (NLS) Knowledge Browser
Similar Messages
-
I want to store and display dates of my application in Arabic Hijri style. Is there any function that converts american date into Arabic Hijri date...?
Or any other sollution for it..?
Note: I m using American_america.we8iso8859p1 character set and also need the sollution in the same...Try this
alter session set NLS_CALENDAR="Arabic Hijrah" ;
When I grepped for Hijri, I got only the above one for Hijri, Hijra & Hijrah.
Also worth trying "Arabic Hijri".
Thanks,
Vinod. -
Database do not start due to error 445
Hi,
We have three databases on one HP-UX 11.31 server, the DB version is 10.2.0.4, we started facing slowness in all the databases, when I tried to connect to the server it was very slow, even the sqlplus was taking very long time, when checked the alert logs of all the databases, found the below error in each alert log file;
ksvcreate: Process(m000) creation failed
Sun Apr 10 12:56:56 2011
ksvcreate: Process(m000) creation failed
Sun Apr 10 12:59:00 2011The server resource utilization was fine with almost 15%CPU utilization, 55% Memory utilization.
I aborted the databases then tried to start them, the startup failed with the below error for all databases;
ORA-00445: background process "PMON" did not start after 120 seconds
The following is the alert log content for one database;
ksvcreate: Process(m000) creation failed
Sun Apr 10 13:09:17 2011
ksvcreate: Process(m000) creation failed
Sun Apr 10 13:24:29 2011
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
WARNING: Could not create SMR
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_10 parameter default value as USE_DB_RECOVERY_FILE_DEST
Autotune of undo retention is turned on.
IMODE=BR
ILAT =242
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Sun Apr 10 13:27:10 2011
ksdpec: called for event 13740 prior to event group initialization
Starting up ORACLE RDBMS Version: 10.2.0.4.0.
System parameters with non-default values:
processes = 2000
sga_max_size = 3221225472
__shared_pool_size = 1828716544
__large_pool_size = 16777216
__java_pool_size = 16777216
__streams_pool_size = 16777216
nls_date_format = dd-mm-yyyy
nls_calendar = Arabic Hijrah
filesystemio_options = NONE
disk_asynch_io = FALSE
sga_target = 3221225472
control_files = /oradb/oradata/centl/control01.ctl, /oradb/oradat
a/cent/control02.ctl, /oradb/oradata/cent/control03.ctl
db_block_size = 8192
__db_cache_size = 1325400064
db_writer_processes = 4
compatible = 10.2.0.3.0
db_file_multiblock_read_count= 16
db_recovery_file_dest = /arch
db_recovery_file_dest_size= 32212254720
undo_management = AUTO
undo_tablespace = UNDOTBS1
remote_login_passwordfile= EXCLUSIVE
db_domain =
dispatchers = (PROTOCOL=TCP) (SERVICE=centlXDB)
smtp_out_server = 10.241.16.118:25
job_queue_processes = 10
background_dump_dest = /u01/app/oracle/admin/cent/bdump
user_dump_dest = /u01/app/oracle/admin/centl/udump
max_dump_file_size = 1024
core_dump_dest = /u01/app/oracle/admin/cent/cdump
audit_file_dest = /u01/app/oracle/admin/cent/adump
db_name = cent
open_cursors = 2000
pga_aggregate_target = 1699741696
Sun Apr 10 13:31:50 2011
USER: terminating instance due to error 445
Instance terminated by USER, pid = 2089Content for the Trace file for one of the databases;
ORACLE_HOME = /u01/app/oracle/db
System name: HP-UX
Node name: db01
Release: B.11.31
Version: U
Machine: ia64
Instance name: cent
Redo thread mounted by this instance: 0 <none>
Oracle process number: 0
Unix process pid: 4667, image: oracle@db01
*** 2011-04-10 15:44:19.475
Dynamic strand is set to TRUE
Running with 2 shared and 242 private strand(s). Zero-copy redo is FALSE
*** 2011-04-10 15:50:40.280
Waited for process PMON to initialize for 60 seconds
*** 2011-04-10 15:50:40.280
Dumping diagnostic information for PMON:
OS pid = 4701
loadavg : 1.36 1.35 1.29
Swapinfo :
Avail = 15520.08Mb Used = 2490.52Mb
Swap free = 13029.57Mb Kernel rsvd = 1018.08Mb
Free Mem = 10161.05Mb
F S UID PID PPID C PRI NI ADDR SZ WCHAN S
TIME TTY TIME COMD
1401 S oracle 4701 1 0 154 20 e000000413447080 53772 e00000017cefa140 15
:49:39 ? 0:00 ora_pmon_cent
/bin/sh[2]: /opt/langtools/bin/gdb: not found.
*** 2011-04-10 15:50:40.372
*** 2011-04-10 15:50:50.470
Waited for process PMON to initialize for 111 seconds
*** 2011-04-10 15:51:31.180
Dumping diagnostic information for PMON:
OS pid = 4701
loadavg : 1.36 1.35 1.30
Swapinfo :
Avail = 15520.08Mb Used = 2490.52Mb
Swap free = 13029.57Mb Kernel rsvd = 1018.08Mb
Free Mem = 10160.98Mb
F S UID PID PPID C PRI NI ADDR SZ WCHAN S
TIME TTY TIME COMD
1401 S oracle 4701 1 0 154 20 e000000413447080 53772 e00000017cefa140 15
:49:39 ? 0:00 ora_pmon_cent
/bin/sh[2]: /opt/langtools/bin/gdb: not found.
*** 2011-04-10 15:51:31.250
Killing process (ospid 4701): (reason=x4 error=0)
... and the process is still alive after kill!
*** 2011-04-10 15:51:40.190
KSTDUMP: In-memory trace dump
TIME(usecs):SEQ# ORAPID SID EVENT OP DATA
========================================================================
kground PMON
2C463A42:000000F8 1999 0 10254 42 KSBS1P: timed out while waiting
2C463A48:000000F9 1999 0 10254 51 KSBS1P: out of loop: process did not sta
rt
KSTDUMP: End of in-memory trace dump
*** 2011-04-10 15:51:40.190All the databases has similar trace files, I rebooted the server and still none of the database is starting.
The Server resources utilization seems to be fine;
oracle$ iostat 3 3
device bps sps msps
disk3 93 6.9 1.0
disk5 17 2.4 1.0
disk17 0 0.1 1.0
disk3 21 4.3 1.0
disk5 20 4.0 1.0
disk17 0 0.3 1.0
disk3 0 0.0 1.0
disk5 0 0.0 1.0
disk17 0 0.0 1.0
oracle$ swapinfo -tan
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 24576000 0 24576000 0% 0 - 1 /dev/vg00/lvol2
reserve - 918204 -918204
memory 15892564 2550292 13342272 16%
total 40468564 3468496 37000068 9% - 0 -
System: hrdbdr01 Sun Apr 10 16:25:28 2011
Load averages: 1.61, 1.60, 1.55
237 processes: 182 sleeping, 55 running
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 1.61 27.7% 0.0% 71.3% 1.0% 0.0% 0.0% 0.0% 0.0%
1 1.59 32.0% 0.0% 67.0% 1.0% 0.0% 0.0% 0.0% 0.0%
2 1.61 13.0% 14.0% 71.0% 2.0% 0.0% 0.0% 0.0% 0.0%
3 1.60 10.0% 20.0% 69.0% 1.0% 0.0% 0.0% 0.0% 0.0%
avg 1.61 20.8% 8.9% 69.3% 1.0% 0.0% 0.0% 0.0% 0.0%
System Page Size: 4Kbytes
Memory: 974032K (512772K) real, 1317016K (704304K) virtual, 12491712K free Page
# 1/24
CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
3 ? 4249 root 255 39 20140K 1612K run 42:41 49.96 49.88 stm
2 ? 3360 root 255 39 20140K 1612K run 55:11 49.65 49.56 stm
0 ? 3040 root 240 20 20140K 1612K run 72:27 49.08 48.99 stm
1 ? 2419 root 241 20 20140K 1616K run 77:20 48.81 48.73 stm
1 ? 4850 root 168 20 20140K 1612K sleep 4:15 23.99 23.95 stm
2 ? 4583 root 168 20 20140K 1612K sleep 12:21 22.93 22.89 stmThanks for a quick reply!
No changes on the server side, but recently we changed the Windows DNS servers and this unix machine is connected to the domain.
the resolv.conf file contents are
oracle:/etc$ more resolv.conf
domain mc.ed
nameserver 10.141.11.1
nameserver 10.141.11.2But, we have two new DNS servers with 10.141.11.3 and 10.141.11.4.
I think changing the old DNS IPs with the new DNS IPs will resolve the issue. -
hii, all
i would like to compare between this date
CREATE TABLE HR.TEST_CHECK_IN
(CHECK_IN DATE);
INSERT INTO DATE VALUES ('01/3/1433');
INSERT INTO DATE VALUES ('02/3/1433');
INSERT INTO DATE VALUES ('03/3/1433');today in hijrah date is 28/2/1433
when i write this code it's working fine
SELECT TO_DATE(CHECK_IN) ,(TO_CHAR(sysdate+1,'DD-MM-YYYY','nls_calendar=''arabic hijrah''')) HIJRAH
FROM TEST_CHECK_IN
WHERE TO_DATE(CHECK_IN) >(TO_CHAR(sysdate+1,'DD-MM-YYYY','nls_calendar=''arabic hijrah'''))
RESULT
TO_DATE(CHECK_IN) HIJRAH
01/03/33 28-02-1433
02/03/33 28-02-1433
03/03/33 28-02-1433
when i use this code with oracle form builder 10 g he give me this error in run time
frm-40735 ora 01843
IF TO_DATE(:ROOM_DETAILS.CHECK_IN)>(TO_CHAR(sysdate+1,'DD-MM-YYYY','nls_calendar=''arabic hijrah''')) THEN
UPDATE ROOMS
SET WAITING = 'Y',
OCCUPIED= NULL
WHERE ROOM_ID = :ROOM_DETAILS.ROOM_ID;
END IF;
when i change my code to
SELECT TO_CHAR(CHECK_IN) ,(TO_CHAR(sysdate+1,'DD-MM-YYYY','nls_calendar=''arabic hijrah''')) HIJRAH
FROM TEST_CHECK_IN
WHERE TO_CHAR(CHECK_IN) >(TO_CHAR(sysdate+1,'DD-MM-YYYY','nls_calendar=''arabic hijrah'''))
RESULT --> NULL
TO_CHAR(CHECK_IN) HIJRAH
----------------- ----------And I would suggest that you use consistent datatypes in your tables when you test.
You have a test table that uses a DATE datatype:
CREATE TABLE HR.TEST_CHECK_IN
(CHECK_IN DATE);
INSERT INTO DATE VALUES ('01/3/1433');
INSERT INTO DATE VALUES ('02/3/1433');
INSERT INTO DATE VALUES ('03/3/1433');And a query that has ':ROOM_DETAILS.CHECK_IN' which may be a VARCHAR2.
Also you say you tried 849733's suggestion and used 'WHERE TO_DATE(CHECK_IN,'DD-MM-YYYY') ' and go no rows but this TO_DATE with a format string is the same as your original code so would have given the same three rows. -
Dear sirs,
please i need help to show the date on form in format of hegira (as islamic calender)
thanks in advanceHi
u can use the NLS_CALENDAR parameter system pls check the following link
ALTER SESSION SET NLS_CALENDAR='Arabic Hijrah'; http://docs.oracle.com/cd/B14117_01/server.101/b10749/ch3globenv.htm
Amatu Allah -
HIJRI DATE TO GREGORIAN(NEW POST)
hi im trying to query this using sql. the table name of the column is TEST_DATE. with the following data
HIJRI_DATE
17/11/1431
18/11/1431
19/11/1431
how can i convert this data to gregorian? in sql statement?
THANKSthis May help
SQL> WITH tbl AS (SELECT to_date('17/11/1431','DD/MM/YYYY','NLS_CALENDAR=''Arabic Hijrah''') dt FROM DUAL UNION ALL
2 SELECT to_date('18/11/1431','DD/MM/YYYY','NLS_CALENDAR=''Arabic Hijrah''') FROM DUAL UNION ALL
3 SELECT to_date('19/11/1431','DD/MM/YYYY','NLS_CALENDAR=''Arabic Hijrah''') FROM DUAL
4 )
5 SELECT dt,to_char(dt,'dd/mm/yyyy','NLS_CALENDAR=Gregorian')
6 FROM tbl;
DT TO_CHAR(DT
25-OCT-10 25/10/2010
26-OCT-10 26/10/2010
27-OCT-10 27/10/2010
SQL> WITH tbl AS (SELECT to_date('17/11/1431','DD/MM/YYYY','NLS_CALENDAR=Gregorian') dt FROM DUAL UNION ALL
2 SELECT to_date('18/11/1431','DD/MM/YYYY','NLS_CALENDAR=Gregorian') FROM DUAL UNION ALL
3 SELECT to_date('19/11/1431','DD/MM/YYYY','NLS_CALENDAR=Gregorian') FROM DUAL
4 )
5 SELECT dt ,to_char(dt,'dd/mm/yyyy','NLS_CALENDAR=''Arabic Hijrah''')
6 FROM tbl;
DT TO_CHAR(DT
17-NOV-31 11/03/0835
18-NOV-31 12/03/0835
19-NOV-31 13/03/0835 -
Dear Guyz,
anyone guide me how to get hijri date with the format (i.e. YYYY/MM/DD ) 1420/02/25 already date store is in database in report its showing DD/MON/YYYY.
anyhelp would appreciate.
Regards
MoazamMoazam,
I guess that it is best to create a database function with:
TO_CHAR(TO_DATE(ISU_DATE,'YYYYMMDD'),'YYYYMMDD', 'NLS_CALENDAR = '''||'ARABIC HIJRAH''')
and use it in your queries every time you need to get a date.
Otherwise I think that you can probably set the NLS_CALENDAR to ARABIC HIJRAH (via a database procedure?) in a Before Report trigger and then all dates will probably be correct for the report session.
These are the 2 things that I would try.
Dave -
How to display hijri date..
hi everyone!
can someone tell how to convert georgian date into hijri date...
and if the date is some old date....
thanks and regards
Tariq.Here are a few things you might need to know.
1.How to set Calendar to "Arabic Hijrah" ?
2.How to display both Hijrah and Gregorian dates in the same select statement?
3.What is Calendar Deviation?
4.How to set deviation?
Questions & Answers
1.How to set Calendar to "Arabic Hijrah" ?
Answer
Set NLS_CALENDAR parameter in one of the following ways:
1. In the Current session :
SQL> alter session set NLS_CALENDAR="Arabic Hijrah" ;
2. All applications for a specific client:
Set NLS_CALENDAR Variable in client OS environment.
<e.g: On NT: set variable in the registry
On Unix: set UNIX environment variable in .profile/.cshrc>
3. Within SQL function:
SQL> select to_char(sysdate,'day dd month yyyy','nls_calendar=''arabic hijrah''')
from dual ;
References
<Note:30772.1>
2.How to display both Hijrah and Gregorian dates in the same select statement?
Answer
select
to_char(sysdate,'day dd month yyyy','nls_calendar=''arabic hijrah'''),
to_char(sysdate,'day dd month yyyy','nls_calendar=''gregorian''')
from dual ;
References
<bug:1302683>
3.What is Calendar Deviation?
Answer
Since Hijrah month is based on the moon complete revolution around the sun, Hijrah
Calendar has different number of days in a year than Gregorian; therefore some manual
deviation adjustement might be needed for the conversion to/from Gregorian. In other
words HIJRAH calendar is Lunar based, corrections need to be made every so often.
4.How to set deviation?
Answer
1. Shutdown the database
2. Edit lxecal.nlt (lxecal.dat in Oracle7) in $ORACLE_HOME/ocommon/nls.
e.g: to add one day after Sep-29-2000:
DEFINE calendar
calendar_name = "Arabic Hijrah"
DEFINE calendar_deviation
deviation_data = {
<"Sep-29-2000 ad">:1
ENDDEFINE calendar_deviation
ENDDEFINE calendar
Note: Gregorian date specified in the deviation should correspond to one of
29th, 30th or 31th days of the hijrah calendar.
3. Run the NLS Calendar Utility lxegen to register your modification to Oracle calendar
system, this utility generates lxecalah.nlb file in the same directory mentioned above.
4. startup the database.
The same procedure can be followed to subtract days, but number specified in the
deviation_data should be greater than 10.
<e.g: 11 --> subtract one day, 12 --> subtract two days ...etc>
References
Hope this helps
Regards
Grant Ronald
Forms Product Management -
Difference between real Hijri Date with Oracle Hijri date
Dear ALL,
I will appreciate if any one please let me the solution for this problem. In my application I show the Date in Hijri using the NLS setting. but the issue that "i face a deference between the real hijri date with oracle hijri date"
Assume that the real hijri date on 18-SEP-2012 was 02/11/1433 in hijri but in oracle was 03/11/1433
when I execute the following query it shows me "1433/11/03", but the actual Hijri date is "1433/11/02"
select to_char(to_date('20120918','YYYYMMDD'),'YYYY/MM/DD', 'NLS_calendar='''||'ARABIC hijrah') FROM DUAL;
IFTIKHARHi,
It works correctly for me, too:
SELECT TO_CHAR ( TO_DATE ('20120918', 'YYYYMMDD')
, 'YYYY/MM/DD'
, 'NLS_calendar=''ARABIC hijrah'''
) AS h_date
FROM dual;Output:
H_DATE
1433/11/02 I tried it on Oracle versions
9.2.0.6.0
10.1.0.2.0
10.2.0.3.0
11.1.0.6.0
11.2.0.1.0
and got the same results every time. What version of Oracle are you using? What other software (front end, OS, ...)?
If it's consistently giving you the results for the day after the day wanted, then subtract 1 day before calling TO_CHAR. I know this is not a solution, just a work-around until you find and fix the real problem. -
Guyz,
i have tubular block and one display item on canvas which shows the number of days.after querying the records i want to display the below attributes according to number of days display in remain days.
which trigger should i use for this?
im using forms 10g. anyone give me any linnk or any pdf where i can read which trigger where i can use.
IF :MN_EMP_CIVIL_ID.REMAIN_DAYS <30 OR :MN_EMP_CIVIL_ID.REMAIN_DAYS=30 THEN
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.SRNO', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMPID', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMP_NAME', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.CIVIL_ID#', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.ISU_DATE', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EXP_DATE', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.G_DATE', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.REMAIN_DAYS', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.H_DATE', VISUAL_ATTRIBUTE, 'VA_RED');
ELSIF
:MN_EMP_CIVIL_ID.REMAIN_DAYS >31 OR :MN_EMP_CIVIL_ID.REMAIN_DAYS=60 THEN
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.SRNO', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMPID', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMP_NAME', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.CIVIL_ID#', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.ISU_DATE', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EXP_DATE', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.G_DATE', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.REMAIN_DAYS', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.H_DATE', VISUAL_ATTRIBUTE, 'VA_YELLOW');
ELSIF
:MN_EMP_CIVIL_ID.REMAIN_DAYS >61 THEN
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.SRNO', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMPID', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMP_NAME', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.CIVIL_ID#', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.ISU_DATE', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EXP_DATE', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.G_DATE', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.REMAIN_DAYS', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.H_DATE', VISUAL_ATTRIBUTE, 'VA_GREEN');
END IF;I have two block on control block i put two fields FRM_HIJRI and HIJRI_TO
and i put the below code on pre_query trigger on control block.
GO_BLOCK('MN_EMP_CIVIL_ID');
SET_BLOCK_PROPERTY('MN_EMP_CIVIL_ID',DEFAULT_WHERE,'EXP_DATE BETWEEN :CONTROL.FRM_HIJRI AND :CONTROL.HIJRI_TO');
EXECUTE_QUERY;and on another block mn_emp_civil_id post_query triiger
:SRNO:=GET_BLOCK_PROPERTY('MN_EMP_CIVIL_ID',CURRENT_RECORD);
SELECT TO_CHAR(TO_DATE(SYSDATE,'YYYY/MM/DD'),'YYYY/MM/DD', 'NLS_CALENDAR = '''||'ARABIC HIJRAH''')INTO :MN_EMP_CIVIL_ID.H_DATE FROM DUAL;
SELECT TO_DATE(TO_CHAR(:MN_EMP_CIVIL_ID.EXP_DATE,'YYYYMMDD'),'YYYY/MM/DD', 'NLS_CALENDAR = '''||'ARABIC HIJRAH''') INTO :MN_EMP_CIVIL_ID.G_DATE FROM DUAL;if i add the below code in post_query block level its giving me the below error.
IF :MN_EMP_CIVIL_ID.REMAIN_DAYS <30 OR :MN_EMP_CIVIL_ID.REMAIN_DAYS=30 THEN
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.SRNO', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMPID', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMP_NAME', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.CIVIL_ID#', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.ISU_DATE', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EXP_DATE', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.G_DATE', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.REMAIN_DAYS', VISUAL_ATTRIBUTE, 'VA_RED');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.H_DATE', VISUAL_ATTRIBUTE, 'VA_RED');
ELSIF
:MN_EMP_CIVIL_ID.REMAIN_DAYS >31 OR :MN_EMP_CIVIL_ID.REMAIN_DAYS=60 THEN
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.SRNO', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMPID', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMP_NAME', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.CIVIL_ID#', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.ISU_DATE', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EXP_DATE', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.G_DATE', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.REMAIN_DAYS', VISUAL_ATTRIBUTE, 'VA_YELLOW');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.H_DATE', VISUAL_ATTRIBUTE, 'VA_YELLOW');
ELSIF
:MN_EMP_CIVIL_ID.REMAIN_DAYS >61 THEN
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.SRNO', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMPID', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EMP_NAME', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.CIVIL_ID#', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.ISU_DATE', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.EXP_DATE', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.G_DATE', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.REMAIN_DAYS', VISUAL_ATTRIBUTE, 'VA_GREEN');
SET_ITEM_INSTANCE_PROPERTY('MN_EMP_CIVIL_ID.H_DATE', VISUAL_ATTRIBUTE, 'VA_GREEN');
END IF;
ERROR: frm-40735:post_query trigger raised unhandled exception ora-06502but when i remove the above attribute code its working properly.
Regards
mozam -
Loading date format (Hijra)
Hi all,
We have a Date field which is in the format YYMMDD (Hijra).
Can anyone tell us how to load the specific field by SQL* Loader (setting the NLS Parameters).
Our database is in Western European Character set.
Do we need to change the Character set in order to load the above date format.
Thanks in advance,Vignesh,
NLS_CALENDAR='English Hijrah'
or
NLS_CALENDAR='Arabic Hijrah'
NLS_DATE_FORMAT='YYMMDD'
[These can be set as environmental variables from the sqlldr session]
For more information see:
Oracle® Database Globalization Support Guide
10g Release 1 (10.1)
Part Number B10749-02
I hope this is helpful,
Regards,
Turloch
Oracle Migration Workbench Team -
Why this code give me duplicate data
Hii, all
Why this code give me duplicate data
SELECT (G.NAME_1 ||' '||G.NAME_2||' '||G.NAME_3||' '||G.NAME_4) AS NAME,
R.RES_NUM
FROM GUST G , RESERVATION R,ROOM_DETAILS S,ROOMS RR
WHERE G.RES_NUM = R.RES_NUM
AND R.RES_NUM = S.RES_NUM
AND RR.OCCUPIED = 'Y'
RES_NUM
1282
1282
1282
1282
1280
1280
1280
1280
1281
1281
1281
1281
1310
1310
1310
1310
16 rows selectedI can solve my problem with another solutions
like that
SELECT (G.NAME_1 ||' '||G.NAME_2||' '||G.NAME_3||' '||G.NAME_4) AS NAME,
R.RES_NUM
FROM GUST G , RESERVATION R,ROOM_DETAILS S
WHERE G.RES_NUM = R.RES_NUM
AND R.RES_NUM = S.RES_NUM
AND TO_CHAR(CHECK_OUT,'DD-MM-YYYY')>=(to_char(sysdate+1,'dd-mm-yyyy','nls_calendar=''arabic hijrah'''))but if this code working he will give me result = 100%
SELECT (G.NAME_1 ||' '||G.NAME_2||' '||G.NAME_3||' '||G.NAME_4) AS NAME,
R.RES_NUM
FROM GUST G , RESERVATION R,ROOM_DETAILS S,ROOMS RR
WHERE G.RES_NUM = R.RES_NUM
AND R.RES_NUM = S.RES_NUM
AND RR.OCCUPIED = 'Y'but i can't do that
Edited by: Ahmed_Arafa on Jan 20, 2012 1:25 PM -
How to set date according to hjrah calender : nls_calender='English Hijrah
Hello frnds
how to set dates according to "English Hijrah".
I have set my database nls_calender='English Hijrah' ,
as many people aware that Hijrah dates are depend on moon ,
so I want to know how to set the calender for next month date in the database according to "English Hijrah"
I have set my database calender like this :
Example 3-17 NLS_CALENDAR='English Hijrah'
Set NLS_CALENDAR to English Hijrah.
SQL> ALTER SESSION SET NLS_CALENDAR='English Hijrah';
SELECT SYSDATE FROM DUAL;
You should see output similar to the following:
SYSDATE
24 Ramadan 1430
now I want to set the next month calender ...
I think my question is litte bit confusingmy db version 10.2.0.3
and above metalink id 121061.1 , I have tried from this document , but the change is not effected ,
the steps what I have down ;
1) shutdown the database
2)$oracle_home/nls/lxecal.nlt
i have created new file , and the contents is: syntax or algorithm
DEFINE calendar
calendar_name="English Hijrah"
DEFINE calendar_deviation
deviation_data= {
<"MAY-30-2009 ad">:11
ENDDEFINE calendar_deviation
ENDDEFINE calendar
note: i have to subract 1 day from current month
3) run the file
$ lxegen
4) sql>startup
5) sql>ALTER SESSION SET NLS_CALENDAR='English Hijrah';
6) sql>select sysdate+2 from dual;
SYSDATE+2
30 Jamada El Oula 1430
but my expected output should be like this
SYSDATE+2
01 Jamada El Thaniah 1430
note: that is after 2 days from today I need 1 st of next month , but its showing 30 th of present month , bcoz according to arabic month , present month is for 29 days only... -
Hi All
i need to display the date in arabic Format..my NLS_LANG is (AMERICAN_AMERICA.AR8MSWIN1256)
and i tried to make it (ARABIC_UNITED ARAB EMIRATES.AR8MSWIN1256)
But is not working
pls i need help
thanksHi everybody
waffa ... I think you need to do the following:-
1- open registry HKEY_LOCAL_MACHINE -- SOFTWARE -- ORACLE
inside oracle key add new (string value) and name it (nls_calendar) and put this value(arabic hijrah) inside nls_calendar ..
2-open sql plus and try with
select to_char(sysdate,'yyyy-mm-dd') from dual
will I hope this useful for you ...
Thanks
Mohammed Al-shake -
Is it possible to use "english hijrah" on-the-fly without ALTER SESSION?
SQL> alter session set nls_calendar='english hijrah';
Session altered.
SQL> select '29-02-1435', TO_DATE('29-02-1435', 'DD-MM-RRRR') from dual;
'29-02-1435' TO_DATE('29-02-1435','DD-MM-RRRR')
29-02-1435 29 Safar 1435
Hi, the above shows that an input date of '29-02-1435' can be validated as a correct Hijrah date.
However, is it possible to do such a TO_DATE(), or TO_CHAR() conversion without the overhead of an 'ALTER SESSION' at the start ?
From within a Gregorian session I tried a few things like below, but they didn't work and give ORA-01756: quoted string not properly terminated
select TO_CHAR('29-02-1435', 'nls_calendar="English Hijrah"', 'nls_date_format="DD-MM-RRRR")
from dual;
All we're needing to do is validate the date as valid Hijrah - no further processing is done.
Many thanks for any help. MarkSorry - I had been confusing single and double quotes.
The following shows that it's a valid Arabic date
SQL> select '29-02-1435', TO_DATE('29-02-1435', 'DD-MM-RRRR', 'nls_calendar=''English Hijrah''')
2 from dual;
'29-02-1435' TO_DATE('29-02-
29-02-1435 02-JAN-14
and for example if you put a crazy month, it complains
SQL> select '29-02-1435', TO_DATE('29-92-1435', 'DD-MM-RRRR', 'nls_calendar=''English Hijrah''')
2 from dual;
select '29-02-1435', TO_DATE('29-92-1435', 'DD-MM-RRRR', 'nls_calendar=''English Hijrah''')
ERROR at line 1:
ORA-01843: not a valid month
Maybe you are looking for
-
My mail does not open at all. Thank you
My yahoo mail is very slow. Once it opens, it tells me to use a different mail set up. Everything I click it does not work. After half hour I may get the list of e-mails.They do not open up to read them. This is happening since you have modified mozi
-
NooB needs help sorting php,sql, etc.please
Hi all, This is my first post but I'd like to thank everyone for all the lurking help I've gotten. You guys are great. I've hit a wall. I use dw8, windows xp and have a server through crystal tech. I would like to build a shopping cart for e-commerce
-
Consultants not able to run T-Codes even after profiles are assigned.
Hello Everyone! I'm trying to maintain authorization profiles for SAP Functional Consultants. I want it so that QM Consultant has authorization for using all QM T-Codes & can do only QM Customization, same for SD, MM and so on... For this I've mainta
-
Extra char appears string to FML fails. - Urgent
We are facing an issue we have not scene before. Its between OSB -> Tuxedo WTC integration. We being the team Supporting Tuxedo related Applications can see : Whenever we get a message with 00 at the end it gets successfully processed 12:45:06.0747:1
-
Problems with Windows 2003, JRun and Java 1.4.2_07
Hi! I have installed JRun 4 with J2SE 1.4.2_07 on a Windows 2003 Server and all goes well until someone install a system patch, Office. After that JRun doesn�t star. The logs says: Starting Macromedia JRun 4 (Build 84683), admin server An unexpected