ORA-01843:This is not a valid month error
One of our french customer using Oracle 11g R2 on RHEL is getting following error while running a stored procedure:
ORA-01843: ce n'est pas un mois valide
20120123::05:41:10 ended rebuilding cmroll table
The error reported by ORACLE, in French « ce n'est pas un mois valide », means : « This is not a valid month ».I have asked him to verify the following settings on his machine:
Please run the following query on Oracle Server to get the NLS settings. It specifies the settings both on Oracle client and Server.
select * from nls_database_parameters;
select * from nls_instance_parameters;
However, you can override this setting by specifying the following environment variables in client or server. So kindly verify them on both as well:
1. NLS_LANG
2. NLS_LANGUAGE
3. NLS_TERRITORYIs there anything further that can help me to trace this error?
Moazzam wrote:
ORA-01843: ce n'est pas un mois valide
Is there anything further that can help me to trace this error?ORA-01843 Sounds a LOT more interesting in French :)
I have to agree with the others that there is a problem with the code somewhere - again, the implicit conversion sounds promising. Or possibly a language issue (hopefully not)
You should be getting a line number where the error is occurring. This can sometimes be deceptive; we use a WHEN-OTHERS exception handler but mark the code with a location marker throughout so we can look up errors and their locations in an exceptions table - in other words, the line cited in the error message may/may not be where the error happened. 11g sometimes reports errors on block headers too. There are other ways of finding the line the error is occurring on too, including just looking at the code (which is usually harder). Start by finding the line the error is occurring at.
The "brute force" approach (if possible find an easier way) is to either use the debugger in a GUI tool or use DBMS_OUTPUT.PUT_LINE to trace your way through executions.
When you find out where the error is occurring you can use DBMS_OUTPUT.PUT_LINE to display the value, find out what it is, and figure out what is causing the error, and fix it.
Edited by: riedelme on Mar 13, 2012 7:11 AM
Similar Messages
-
How to solve ORA-01843: not a valid month error
i am gettion ORA-01843: not a valid month error how to solve it. and how to find which record causing
proble.
Thanks in advance.EdStevens wrote:
Ramin Hashimzadeh wrote:
user1571313 wrote:
i am gettion ORA-01843: not a valid month error how to solve it. and how to find which record causing
proble.
Thanks in advance.Bring for me something from somewhere... :)Bring me a shrubbery.
When you have found the shrubbery, then you must cut down the mightiest tree in the forest ... with a herring.We are no longer the knights who say ni! We are now the knights who say "i am gettion ORA-01843"! -
ORA-01843 Not a valid month Error
Dear all,
We did a database upgrade from 9.2.0.1 to 11gR2 and after that everything is working fine.
But now we noticed that the users are getting ORA-01843 Not a valid month Error.
I changed the NLS_DATE_FORMAT in the init.ora file, but still the error persist.
As a work around I changed the NLS_DATE_FORMAT=DD-MM-YYYY on the client pc registry and now its working in that pc..
Is there any other way so that the change gets affected globally ??
Any tips
Thanks in adv,
Maheshmahesh wrote:
Dear all,
We did a database upgrade from 9.2.0.1 to 11gR2 and after that everything is working fine.
But now we noticed that the users are getting ORA-01843 Not a valid month Error.
I changed the NLS_DATE_FORMAT in the init.ora file, but still the error persist.
As a work around I changed the NLS_DATE_FORMAT=DD-MM-YYYY on the client pc registry and now its working in that pc..
Is there any other way so that the change gets affected globally ??
Any tips
Thanks in adv,
MaheshNLS_DATE_FORMAT can be set in multiple places, but it's not an either/or situation. Setting it in an init parm at the db level is the WEAKEST setting. That setting is overridden by the client OS, which in turn can be overridden by an ALTER SESSION, which in turn can be overridden by use of TO_CHAR and TO_DATE at the individual sql statement. and if the date is being entered by a human at a keyboard (actually keyed in, not picked from a calendar tool or some sort of drop-down pick list) you really have no direct control over the format of the string they key in. So ultimately it is up to the application to insure that character strings presented as dates are in the correct format.
Which is why I advise developers to ALWAYS use to_char and to_date at the sql statement level. It is the only way they can insure control over the setting. -
01843. 00000 - "not a valid month"
HI EXPERTS,
CAN YOU TEL ME I GOT A ERROR LIKE THIS 01843. 00000 - "not a valid month"
DECLARE
V_LINE VARCHAR2(2000); -- Data line read from input file
V_FILE UTL_FILE.FILE_TYPE;
V_DIR VARCHAR2(250);
V_FILENAME VARCHAR2(50);
BEGIN
V_DIR :='MID5010_DOC1TP';
V_FILENAME := 'OPT_CM_BASE.txt';
V_FILE := UTL_FILE.FOPEN(V_DIR, V_FILENAME, 'r');
LOOP
BEGIN
UTL_FILE.GET_LINE(V_FILE, V_LINE);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END ;
v_line := replace(v_line,'|','|~');
INSERT INTO OPTUM_ICD10CM_BASE
VALUES (
translate(regexp_substr(v_line,'[^|]+',1,1),'a~','a'),
translate(regexp_substr(v_line,'[^|]+',1,2),'a~','a'),
translate(regexp_substr(v_line,'[^|]+',1,3),'a~','a'),
translate(regexp_substr(v_line,'[^|]+',1,4),'a~','a'),
translate(regexp_substr(v_line,'[^|]+',1,5),'a~','a'),
case when length(regexp_substr(v_line,'[^|]+',1,6)) < 10 then
to_date(ltrim(translate(regexp_substr(v_line,'[^|]+',1,6),'a~','a'),'0'),'mm-yyyy')
else
to_date(translate(regexp_substr(v_line,'[^|]+',1,6),'a~','a'),'mm-dd-yyyy')
end,
case when length(regexp_substr(v_line,'[^|]+',1,7)) < 10 then
to_date(ltrim(translate(regexp_substr(v_line,'[^|]+',1,7),'a~','a'),'0'),'mm-yyyy')
else
to_date(translate(regexp_substr(v_line,'[^|]+',1,7),'a~','a'),'mm-dd-yyyy')
end,
case when length(regexp_substr(v_line,'[^|]+',1,8)) < 10 then
to_date(ltrim(translate(regexp_substr(v_line,'[^|]+',1,8),'a~','a'),'0'),'mm-yyyy')
else
to_date(translate(regexp_substr(v_line,'[^|]+',1,8),'a~','a'),'mm-dd-yyyy')
end,
case when length(regexp_substr(v_line,'[^|]+',1,9)) < 10 then
to_date(ltrim(translate(regexp_substr(v_line,'[^|]+',1,9),'a~','a'),'0'),'mm-yyyy')
else
to_date(translate(regexp_substr(v_line,'[^|]+',1,9),'a~','a'),'mm-dd-yyyy')
end,
case when length(regexp_substr(v_line,'[^|]+',1,10)) < 10 then
to_date(ltrim(translate(regexp_substr(v_line,'[^|]+',1,10),'a~','a'),'0'),'mm-yyyy')
else
to_date(translate(regexp_substr(v_line,'[^|]+',1,10),'a~','a'),'mm-dd-yyyy')
end,
translate(regexp_substr(v_line,'[^|]+',1,11),'a~','a')
-----commit;
END LOOP;
UTL_FILE.FCLOSE(V_FILE);
END;hi
this is my formted script i got a some errors
i want only utl_file script no need external table
DECLARE
V_LINE VARCHAR2(2000); -- Data line read from input file
V_FILE UTL_FILE.FILE_TYPE;
V_DIR VARCHAR2(250);
V_FILENAME VARCHAR2(50);
BEGIN
V_DIR :='MID5010_DOC1TP';
V_FILENAME := 'OPT_CM_BASE.txt';
V_FILE := UTL_FILE.FOPEN(V_DIR, V_FILENAME, 'r');
LOOP
BEGIN
UTL_FILE.GET_LINE(V_FILE, V_LINE);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END ;
v_line := REPLACE(v_line,'|','|~');
INSERT
INTO OPTUM_ICD10CM_BASE VALUES
TRANSLATE(regexp_substr(v_line,'[^|]+',1,1),'a~','a'),
TRANSLATE(regexp_substr(v_line,'[^|]+',1,2),'a~','a'),
TRANSLATE(regexp_substr(v_line,'[^|]+',1,3),'a~','a'),
TRANSLATE(regexp_substr(v_line,'[^|]+',1,4),'a~','a'),
TRANSLATE(regexp_substr(v_line,'[^|]+',1,5),'a~','a'),
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|]+',1,6)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|]+',1,6),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,6),'a~','a'),'mm-dd-yyyy')
END,
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|]+',1,7)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|]+',1,7),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,7),'a~','a'),'mm-dd-yyyy')
END,
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|]+',1,8)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|]+',1,8),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,8),'a~','a'),'mm-dd-yyyy')
END,
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|]+',1,9)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|]+',1,9),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,9),'a~','a'),'mm-dd-yyyy')
END,
CASE
WHEN LENGTH(regexp_substr(v_line,'[^|]+',1,10)) < 10
THEN to_date(ltrim(TRANSLATE(regexp_substr(v_line,'[^|]+',1,10),'a~','a'),'0'),'mm-yyyy')
ELSE to_date(TRANSLATE(regexp_substr(v_line,'[^|]+',1,10),'a~','a'),'mm-dd-yyyy')
END,
TRANSLATE(regexp_substr(v_line,'[^|]+',1,11),'a~','a')
-----commit;
END LOOP;
UTL_FILE.FCLOSE(V_FILE);
END;
A50.0||Short|Long|Full|01-01-2009|01-2009||01-01-2013|09-18-2012|C|
A50.1||Short|Long|Full|01-01-2009|01-01-2009||001-2013|09-18-2012|C|
A50.2||Short|Long|Full|01-01-2009|01-01-2009|67|01-01-2013|09-18-2012|C|
A50.3||Short|Long|Full|011-2009|01-01-2009||01-01-2013|09-18-2012|C|
A50.4||Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|5|
A50.5|R|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A50.6||Short|Long||01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A50.7||Short||Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
2345||Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.0|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.2|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.3|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.4|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.5|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.6|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.7|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.8|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A60.9|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.0|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.2|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.3|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A70.4|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
B222|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.2|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.3|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.4|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.5|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.6|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.7|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.8|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A4.9|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.0|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.2|D|Short|Long|Full|01-01-2009|01-01-2009|01-10-2013|01-01-2013|09-18-2012|C|
A5.3|D|Short|Long|Full|01-01-2009|01-01-2009|01-10-2013|01-01-2013|09-18-2012|C|
D642|D|Short|Long|Full|01-01-2009|01-01-2009|01-10-2013|01-01-2013|09-18-2012|C|
A5.5|D|Short|Long|Full|01-01-2009|01-01-2009|01-10-2013|01-01-2013|09-18-2012|C|
A5.6|D|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.7|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A001|C|Short Updated|Long Updated|Full Updated|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A009|C|Short Updated|Long Updated|Full Updated|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A5.10|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A0109|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.0|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.1|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.2|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.3|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.4|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.5|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.6|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
F10.7|N|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A30|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A316|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C|
A317|C|Short|Long|Full|01-01-2009|01-01-2009||01-01-2013|09-18-2012|C| -
Period Comparison - getting not a valid month error
I am trying to do a period comparison. I have the query condition as
select ppv.draft_invoice_num
,ppv.ra_invoice_number
,ppv.invoice_date
, idv.expenditure_item_date
,ppv.gl_date
,ppv.gl_period
,to_date(ppv.gl_period,'MON-YY')
--,idv.bill_amount
-- ,ppv.org_id
from pa_proj_invoices_view ppv
,pa_proj_invoice_details_view idv
where ppv.project_id= idv.project_id
and ppv.draft_invoice_num = idv.draft_invoice_num
and ppv.project_id = 25
and idv.expenditure_item_date between '01-MAR-09' and '30-APR-09'
and to_date(ppv.gl_period,'MON-YY') between to_date('MAR-09','MON-YY') and last_day(to_date('MAY-09','MON-YY'))
group by ppv.draft_invoice_num
,ppv.ra_invoice_number
,ppv.invoice_date
, idv.expenditure_item_date
,ppv.gl_date
,ppv.gl_period
order by ppv.draft_invoice_num;
I get an "Not a Valid Month" error. How can I do the date comparison? I have tried number of options . How can I compare the ppv.gl_period for a range of periods?
ThanksHi,
1)
lv_date := '09/25/2009';lv_date is a variable of datatype date, but you are assigning a varchar, which Oracle is not able to do implicit conversion because of nls_date_format
change to something like to_date('09/25/2009','mm/dd/yyyy')
2)
lv_date:= TO_DATE(lv_date,'MM/DD/YY');
lv_date:= TO_CHAR(lv_date,'MM/DD/YY');Why would be assinging a char value to date datatype. Use any one depending on datatype of lv_date
Regards
Anurag Tibrewal. -
Getting Ora 01843 not a Valid month Error
Hi
I was trying to assign the data in MM/DD/YY format
from a date value '09/25/2009'..
I cannot Obain the result i always get this
ORA-01843: not a valid month
May i ask you kindly to help me out here.
Below is the code Snippet;
DECLARE
lv_date DATE;
BEGIN
lv_date := '09/25/2009';
BEGIN
lv_date:= TO_DATE(lv_date,'MM/DD/YY');
lv_date:= TO_CHAR(lv_date,'MM/DD/YY');
-- I slso tried this way but same error.
-- lv_date := TO_CHAR(TO_DATE(lv_date,'MM/DD/YYYY'),'MM/DD/YY');
END;
DBMS_OUTPUT.PUT_LINE('the date format is = '|| lv_date);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('Err from MainBlock '|| SQLCODE || SQLERRM);
END;Hi,
1)
lv_date := '09/25/2009';lv_date is a variable of datatype date, but you are assigning a varchar, which Oracle is not able to do implicit conversion because of nls_date_format
change to something like to_date('09/25/2009','mm/dd/yyyy')
2)
lv_date:= TO_DATE(lv_date,'MM/DD/YY');
lv_date:= TO_CHAR(lv_date,'MM/DD/YY');Why would be assinging a char value to date datatype. Use any one depending on datatype of lv_date
Regards
Anurag Tibrewal. -
Throwing not a valid month error(ORA-01843)
Hi,
Can you please tell me whats wrong with the statement
select Fas_Rpt_Disclose_Summ_Pkg.F_EXR_COLUMN_VALUES(3,5207773,TO_DATE('28-JUN-06','DD-MON-YY'),TO_DATE('26-Sep-06','DD-MON-YY'),TO_DATE('26-SEP-06:23:59:59','DD-MON-YY:HH24:MI:SS'),'INTRINSICVALEXR') from dual;
ThanksWhat is the current value of NLS_DATE_LANGUAGE?
SQL> alter session set nls_date_language='ENGLISH';
Session altered.
SQL> select TO_DATE('28-JUN-06','DD-MON-YY'),
2 TO_DATE('26-Sep-06','DD-MON-YY'),
3 TO_DATE('26-SEP-06:23:59:59','DD-MON-YY:HH24:MI:SS')
4 from dual;
TO_DATE(' TO_DATE(' TO_DATE('
28-JUN-06 26-SEP-06 26-SEP-06
SQL> alter session set nls_date_language='FRENCH';
Session altered.
SQL> select TO_DATE('28-JUN-06','DD-MON-YY'),
2 TO_DATE('26-Sep-06','DD-MON-YY'),
3 TO_DATE('26-SEP-06:23:59:59','DD-MON-YY:HH24:MI:SS')
4 from dual;
select TO_DATE('28-JUN-06','DD-MON-YY'),
ERROR at line 1:
ORA-01843: not a valid month
SQL> -
Replicat abends with "not a valid month" error
Here is what i see in the log:
2015-04-16 14:02:21 ERROR OGG-00665 OCI Error Flushing database inbound server, 'OGG$REP02' (status = 26815-ORA-26815: Error from Apply Network Receiver for Apply "OGG$REP02" and Capture "replicat".
ORA-01843: not a valid month), SQL<select status, deferrable from dba_constraints where owner =UPPER('PRIME') and table_name=UPPER('FGCTRXNMESSAGERULES') and constraint_type = 'P' >.
My replicat is integrated with parallelism set to 4.
How can i find the error? Thanks.Hi ,
Could you please share the extract and replicat parameter's contents?
What is the version of GG you are using?
Did you check the Character set of both source and target?
Regards,
Veera -
Not a valid month error..
Hello all,
I have a nagging problem with front end code. I have got stored procedure written which runs perfectly fine when called from oracle Pl/SQL developer. But when the same procedure is called from .Net application it throws the following exception.
************Exception message****************
"not a valid month"
************Exception message End****************
************Stored procedure code****************
PROCEDURE getall_by_date
P_DATE IN DATE,
EVENT_FREQUENCY IN NVARCHAR2,
CRM_EVENTS_RECORDS OUT SYS_REFCURSOR
IS
BEGIN
IF LOWER(EVENT_FREQUENCY) = 'day(s)' THEN
OPEN CRM_EVENTS_RECORDS FOR
SELECT
CRM_EVENTS.ID,
CRM_EVENTS.EVENT_NAME,
CRM_EVENTS.EVENT_TYPE,
CRM_EVENTS.PUBLIC_VIEW,
CRM_EVENTS.LOCATION,
CRM_EVENTS.STATUS,
CRM_EVENTS.PRIORITY,
CRM_EVENTS.DESCRIPTION AS E_DESCRIPTION,
CRM_EVENTS.SEND_NOTIFICATION,
CRM_EVENTS.START_DATE,
CRM_EVENTS.END_DATE,
CRM_EVENTS.EVENT_DAYS,
CRM_EVENTS.EVENT_HOURS,
CRM_EVENTS.EVENT_MINUTES,
CRM_RECURRINGEVENTS.ID,
CRM_RECURRINGEVENTS.RECURRINGDATE,
CRM_RECURRINGEVENTS.REMINDER_SENT,
CRM_RECURRINGEVENTS.REMINDER_TIME
FROM
CRM_EVENTS, CRM_RECURRINGEVENTS
WHERE
TO_DATE(TO_CHAR(TO_TIMESTAMP(CRM_RECURRINGEVENTS.RECURRINGDATE,'DD-MM-YYYY HH:MI:SS.FF AM'),'DD-MM-YYYY'),'DD-MM-YYYY') = to_Date(P_DATE,'DD-MM-YYYY')
AND
CRM_RECURRINGEVENTS.CRM_EVENTS_ID = CRM_EVENTS.ID
ORDER BY
CRM_RECURRINGEVENTS.RECURRINGDATE DESC;
ELSIF LOWER(EVENT_FREQUENCY) = 'month(s)' THEN
OPEN CRM_EVENTS_RECORDS FOR
SELECT
CRM_EVENTS.ID,
CRM_EVENTS.EVENT_NAME,
CRM_EVENTS.EVENT_TYPE,
CRM_EVENTS.PUBLIC_VIEW,
CRM_EVENTS.LOCATION,
CRM_EVENTS.STATUS,
CRM_EVENTS.PRIORITY,
CRM_EVENTS.DESCRIPTION AS E_DESCRIPTION,
CRM_EVENTS.SEND_NOTIFICATION,
CRM_EVENTS.START_DATE,
CRM_EVENTS.END_DATE,
CRM_EVENTS.EVENT_DAYS,
CRM_EVENTS.EVENT_HOURS,
CRM_EVENTS.EVENT_MINUTES,
CRM_RECURRINGEVENTS.ID,
CRM_RECURRINGEVENTS.RECURRINGDATE,
CRM_RECURRINGEVENTS.REMINDER_SENT,
CRM_RECURRINGEVENTS.REMINDER_TIME
FROM
CRM_EVENTS, CRM_RECURRINGEVENTS
WHERE
TO_CHAR(CRM_RECURRINGEVENTS.RECURRINGDATE,'MM') = TO_CHAR(TO_DATE(P_DATE,'DD-MM-YYYY'),'MM')
AND
CRM_RECURRINGEVENTS.CRM_EVENTS_ID = CRM_EVENTS.ID
ORDER BY
CRM_RECURRINGEVENTS.RECURRINGDATE DESC;
ELSIF LOWER(EVENT_FREQUENCY) = 'year' THEN
OPEN CRM_EVENTS_RECORDS FOR
SELECT
CRM_EVENTS.ID,
CRM_EVENTS.EVENT_NAME,
CRM_EVENTS.EVENT_TYPE,
CRM_EVENTS.PUBLIC_VIEW,
CRM_EVENTS.LOCATION,
CRM_EVENTS.STATUS,
CRM_EVENTS.PRIORITY,
CRM_EVENTS.DESCRIPTION AS E_DESCRIPTION,
CRM_EVENTS.SEND_NOTIFICATION,
CRM_EVENTS.START_DATE,
CRM_EVENTS.END_DATE,
CRM_EVENTS.EVENT_DAYS,
CRM_EVENTS.EVENT_HOURS,
CRM_EVENTS.EVENT_MINUTES,
CRM_RECURRINGEVENTS.ID,
CRM_RECURRINGEVENTS.RECURRINGDATE,
CRM_RECURRINGEVENTS.REMINDER_SENT,
CRM_RECURRINGEVENTS.REMINDER_TIME
FROM
CRM_EVENTS, CRM_RECURRINGEVENTS
WHERE
TO_CHAR(CRM_RECURRINGEVENTS.RECURRINGDATE,'YYYY') = TO_CHAR(TO_DATE(P_DATE,'DD-MM-YYYY'),'YYYY')
AND
CRM_RECURRINGEVENTS.CRM_EVENTS_ID = CRM_EVENTS.ID
ORDER BY
CRM_RECURRINGEVENTS.RECURRINGDATE DESC;
ELSIF LOWER(EVENT_FREQUENCY) = 'week(s)' THEN
OPEN CRM_EVENTS_RECORDS FOR
SELECT
CRM_EVENTS.ID,
CRM_EVENTS.EVENT_NAME,
CRM_EVENTS.EVENT_TYPE,
CRM_EVENTS.PUBLIC_VIEW,
CRM_EVENTS.LOCATION,
CRM_EVENTS.STATUS,
CRM_EVENTS.PRIORITY,
CRM_EVENTS.DESCRIPTION AS E_DESCRIPTION,
CRM_EVENTS.SEND_NOTIFICATION,
CRM_EVENTS.START_DATE,
CRM_EVENTS.END_DATE,
CRM_EVENTS.EVENT_DAYS,
CRM_EVENTS.EVENT_HOURS,
CRM_EVENTS.EVENT_MINUTES,
CRM_RECURRINGEVENTS.ID,
CRM_RECURRINGEVENTS.RECURRINGDATE,
CRM_RECURRINGEVENTS.REMINDER_SENT,
CRM_RECURRINGEVENTS.REMINDER_TIME
FROM
CRM_EVENTS, CRM_RECURRINGEVENTS
WHERE
TO_CHAR(CRM_RECURRINGEVENTS.RECURRINGDATE,'W') = TO_CHAR(TO_DATE(P_DATE,'DD-MM-YYYY'),'W')
AND
TO_CHAR(CRM_RECURRINGEVENTS.RECURRINGDATE,'MM') = TO_CHAR(TO_DATE(P_DATE,'DD-MM-YYYY'),'MM')
AND
TO_CHAR(CRM_RECURRINGEVENTS.RECURRINGDATE,'YYYY') = TO_CHAR(TO_DATE(P_DATE,'DD-MM-YYYY'),'YYYY')
AND
CRM_RECURRINGEVENTS.CRM_EVENTS_ID = CRM_EVENTS.ID
ORDER BY
CRM_RECURRINGEVENTS.RECURRINGDATE DESC;
END IF;
END;;
************Stored procedure code End****************
************C#.NET code****************
using System;
using System.Collections.Generic;
using System.Text;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
using System.Data;
namespace BussLayer
public class Event
string eventName;
string startDate;
string endDate;
int public_view;
string priority;
int EventType;
int sendNotification;
string location;
int eventstatus;
string description;
int EventId;
int on_every;
string first_or_last;
int day_of_month;
string day_name;
string repeat_frequency;
int sun;
int mon;
int tue;
int wed;
int thu;
int fri;
int sat;
int repeat_enabled;
string single_date;
string relatedType;
int relatedToId;
int Remind_Time_Days;
int Remind_Time_Mins;
int Remind_Time_Hrs;
String pDate;
String EVENT_FREQUENCY;
public String p_Date
get { return pDate; }
set { pDate = value; }
public String p_EVENT_FREQUENCY
get { return EVENT_FREQUENCY; }
set { EVENT_FREQUENCY = value; }
public int p_Remind_Time_Hrs
get { return Remind_Time_Hrs; }
set { Remind_Time_Hrs = value; }
public int p_Remind_Time_Mins
get { return Remind_Time_Mins; }
set { Remind_Time_Mins = value; }
public int p_Remind_Time_Days
get { return Remind_Time_Days; }
set { Remind_Time_Days = value; }
public int p_RelatedToId
get { return relatedToId; }
set { relatedToId = value; }
public string p_relatedType
get { return relatedType; }
set { relatedType = value; }
public string p_singleDate
get { return single_date; }
set { single_date = value; }
public string p_endDate
get { return endDate; }
set { endDate = value; }
public string p_startDate
get { return startDate; }
set { startDate = value; }
public int p_on_every
get { return on_every; }
set { on_every = value; }
public string p_first_or_last
get { return first_or_last; }
set { first_or_last = value; }
public int p_day_of_month
get { return day_of_month; }
set { day_of_month = value; }
public string p_day_name
get { return day_name; }
set { day_name = value; }
public string p_repeat_freq
get { return repeat_frequency; }
set { repeat_frequency = value; }
public int p_repeat_enabled
get { return repeat_enabled; }
set { repeat_enabled = value; }
public int p_sat
get { return sat; }
set { sat = value; }
public int p_fri
get { return fri; }
set { fri = value; }
public int p_thu
get { return thu; }
set { thu = value; }
public int p_wed
get { return wed; }
set { wed = value; }
public int p_tue
get { return tue; }
set { tue = value; }
public int p_mon
get { return mon; }
set { mon = value; }
public int p_sun
get { return sun; }
set { sun = value; }
public int p_eventType
get { return EventType; }
set { EventType = value; }
public string p_Description
get { return description; }
set { description = value; }
public int p_EvnetId
get { return EventId; }
set { EventId = value; }
public string p_eventName
get { return eventName; }
set { eventName = value; }
public int p_PublicView
get { return public_view; }
set { public_view = value; }
public string p_priority
get { return priority; }
set { priority = value; }
public int p_activityType
get { return EventType; }
set { EventType = value; }
public int p_sendNotification
get { return sendNotification; }
set { sendNotification = value; }
public string p_location
get { return location; }
set { location = value; }
public int p_eventstatus
get { return eventstatus; }
set { eventstatus = value; }
public DataTable GETALL_BY_DATE()
Int64 return_Status;
String strstatus = "";//To receive the exception msg receive from brick
OracleCommand objcmd = new OracleCommand(); //Holder object
DataTable dt = new DataTable();
OracleParameter[] orapm = new OracleParameter[3];//parameter objects Note: Length should be No. of sp parameters
OracleCommand[] arcmr = new OracleCommand[1];
oracle_brick.baked_brick brc = new oracle_brick.baked_brick(BussLayer.PublicSetting.conString);
String cmdtype = "sp";
String Cmdstring = "CRM_RECURRINGEVENTS_TAPI.GETALL_BY_DATE";
orapm[0] = new OracleParameter();
orapm[0].OracleDbType = OracleDbType.Date;
orapm[0].Direction = ParameterDirection.Input;
orapm[0].ParameterName = "P_DATE";
orapm[0].Value =Convert.ToDateTime(p_Date).ToString("dd-MM-yyyy");
orapm[1] = new OracleParameter();
orapm[1].OracleDbType = OracleDbType.NVarchar2;
orapm[1].Direction = ParameterDirection.Input;
orapm[1].ParameterName = "EVENT_FREQUENCY";
orapm[1].Value = p_EVENT_FREQUENCY;
orapm[2] = new OracleParameter();
orapm[2].OracleDbType = OracleDbType.RefCursor;
orapm[2].Direction = ParameterDirection.Output;
orapm[2].ParameterName = "CRM_EVENTS_RECORDS";
return_Status = brc.CreateCommand(ref cmdtype, ref Cmdstring, ref objcmd, ref strstatus, ref orapm);
return_Status = brc.GetDataTable(ref objcmd, ref dt, ref strstatus);
return dt;
************C#.NET code End****************Those are the main tables used:
SQL> descr ident
Name Null? Type
CRSW_ID NOT NULL VARCHAR2(256)
COMPONENT_KEY NUMBER(10)
JURIS_ID NOT NULL NUMBER(4)
DOC_TYPE_ID NUMBER(4)
WEST_ID VARCHAR2(20)
LOAD_DATE DATE
MOD_DATE DATE
STATUS NOT NULL CHAR(1)
EFFECTIVE_DATE VARCHAR2(10)
LONG_TITLE VARCHAR2(2000)
SHORT_TITLE VARCHAR2(2000)
LANGUAGE CHAR(1)
TYPE_OF_DOC VARCHAR2(20)
FLAG_COLOUR CHAR(1)
ACTION_TYPE CHAR(1)
FLAG_OVERRIDE_IND CHAR(1)
OWNER NOT NULL CHAR(1)
FLAGPROP_IND NOT NULL CHAR(1)
METADATA_ACTION_TYPE NOT NULL CHAR(1)
METADATA_STATUS NOT NULL CHAR(1)
NOVUS_GUID NOT NULL CHAR(33)
SQL> descr abr_archive
Name Null? Type
CRSW_ID NOT NULL VARCHAR2(256)
XML_DOC SYS.XMLTYPE
LOAD_DATE NOT NULL DATE
MOD_DATE NOT NULL DATE
SQL> descr abridgment
Name Null? Type
CRSW_ID NOT NULL VARCHAR2(256)
DGN_LOCATOR VARCHAR2(30)
KEYCLASS VARCHAR2(40)
SUBJ_CODE VARCHAR2(3)
MOD_DATE DATE
ABRCLASS_IND NOT NULL CHAR(1)
SQL> descr rpt_main
Name Null? Type
RPT_ID NOT NULL NUMBER
RPT_GROUP_ID NOT NULL NUMBER
RPT_CODE NOT NULL VARCHAR2(10)
RPT_NAME NOT NULL VARCHAR2(100)
SRCH_CRITERIA VARCHAR2(4000)
EML_TARGET VARCHAR2(2000)
EML_SUBJ VARCHAR2(150)
SUBSCR_NO VARCHAR2(20)
SUBSCR_PREFIX VARCHAR2(10)
START_DATE NOT NULL DATE
SCHED_DAYS NUMBER
WEED_DATE DATE
ISSUE_NO NUMBER
STATUS NOT NULL CHAR(1)
ABORT_THRESHOLD NUMBER
SCHED_DATE DATE
EML_ATTACHMENT_NAME VARCHAR2(200)
SQL> descr relation
Name Null? Type
CITING_DOC NOT NULL VARCHAR2(256)
CITED_DOC NOT NULL VARCHAR2(256)
DISPLAY_TEXT VARCHAR2(256)
HISTORY_CODE NOT NULL NUMBER(4)
SORT_ID NOT NULL NUMBER(10)
MOD_DATE NOT NULL DATE
EXPIRED_IND NOT NULL CHAR(1)
Thanks, -
ORA-01843: not a valid month error is coming
Hi,
whats wrong with the query
SELECT to_timestamp((to_char(tO_date('09/29/2006', 'mm/dd/yyyy'))||':'||TO_CHAR(systimestamp,'hh24:mi:ss:ff6')), 'mm/dd/yyyy:hh24:mi:ss:ff6')
FROM DUAL;SQL> SELECT (to_char(tO_date('09/29/2006', 'mm/dd/yyyy'))||':'||TO_CHAR(systimestamp,'hh24:mi:ss:ff6'))
2 FROM dual;
(TO_CHAR(TO_DATE('09/29/2006
29-SEP-06:01:33:09:023000
But you want mm/dd/yyyy hh24:mi:ss:ff6 format then use TO_CHAR function for format specifier
SQL> SELECT to_char(to_timestamp((to_char(tO_date('09/29/2006', 'mm/dd/yyyy'))||':'||TO_CHAR(systimestamp,'hh24:mi:ss:ff6')), 'dd/mm/yyyy hh24:mi:ss:ff6'),'mm/dd/yyyy hh24:mi:ss:ff6')
2 FROM DUAL
3 /
TO_CHAR(TO_TIMESTAMP((TO_CHAR
09/29/0006 01:40:27:113000
SQL> Khurram -
How to handle ORA-12053: this is not a valid nested materialized view
Hi,
I've been trying to create nested MV's for a while and encountered with this error and not able to find a solution even after spending lot of time on this.
Here is the problem.
--> I've 3 base tables Tab1, Tab2, Tab3, which r not having pk's on them (restriction).
--> Created logs on these tables.
--> Created 1st level MV's with pk's (from different schema - siebel schema) defined as MV10,MV11,MV12 with required columns from each base table. These mv's r made fast/complete refresh ... doesn't matter much as complete refresh is done fast (tried both .. just in case if thatz the reason for my error msg).
CREATE MATERIALIZED VIEW mv10
REFRESH COMPLETE/FAST
WITH ROWID
AS
select
col1
,col2
FROM siebel.Tab1@dblink _name;
--> Created MV logs on MV10,MV11,MV12.
--> Created 2nd level MV (join MV) that is based on MV10,MV11,MV12 having join and filter coniditions ... and this gives the error.
I think i've followd all the rules for nested MV and Fast Refreshable rules, but for some reason not able to make it work. Plz throw some light on this.
Thanks
Srinivas VemuriYou will need to use WHEN OTHERS EXCEPTION handler which is not a good idea to do so if you dont handle the same approprialtly then the exception would go un-noticed:
SQL> ed
Wrote file afiedt.buf
1 begin
2 execute immediate 'drop table my_Test';
3 exception
4 when others then
5 dbms_output.put_line(SQLCODE||SQLERRM);
6* end;
SQL> /
-942ORA-00942: table or view does not exist
PL/SQL procedure successfully completed.
SQL> -
Trying to use PL/SQL to automatically create a report that show the following:
Daily:
# of Registered Users
# of Completes (assessment) Average per User
# of Starts (assessment) Average per User
Weekly:
# of Registered Users
# of Completes (assessment) Average per User
# of Starts (assessment) Average per User
Yearly:
# of Registered Users
# of Completes (assessment) Average per User
# of Starts (assessment) Average per User
When I run the PL/SQL I get the following
[error]
ORA-01843: not a valid month
[error]
The error occurs on this part of the PL/SQL
--registered users weekly starts
select count(*), trunc(next_day(sysdate-29, 'SUNDAY')-7), trunc(sysdate-29)
into v_weekly_count_total_ru, v_weekly_start_date, v_weekly_end_date
from entities
where list_id = 3290
and participation_code_id = 10
and trunc(participation_date)
between trunc(next_day(sysdate-29, 'SUNDAY')-7) and
trunc(sysdate-29);I'm using the number 29 because I'm using a test database to test this first before moving it into production. And my test data only goes back to early August 2006.
Also, I'm not doing anything with months, so I am suprised that it is throwing this type of error.
thanksI tested a snippet of code in my production environment, just to see if I would get any results:
--registered users weekly starts
select count(*), trunc(next_day(sysdate-1, 'SUNDAY')-7), trunc(sysdate-1)
--into v_weekly_count_total_ru, v_weekly_start_date, v_weekly_end_date
from entities
where list_id = 3290
and participation_code_id = 10
and trunc(participation_date)
between trunc(next_day(sysdate-1, 'SUNDAY')-7) and trunc(sysdate-1);
COUNT(*) TRUNC(NEXT_DAY(SYSDATE-1,'SUND TRUNC(SYSDATE-1)--INTOV_WEEKLY
1 09/10/2006 00:00:00 09/11/2006 00:00:00I did a double check in my test DB to make sure there is data there:
select count(*)
from entities
where trunc(participation_date)
between to_date('01-08-2006','DD-MM-YYYY')
and to_date('14-08-2006','DD-MM-YYYY')
and list_id = 3290;
COUNT(*)
11So I'm pretty sure that I'm not pulling anything null.
thanks -
Error - ORA-01843: NOT A VALID MONTH
I get this Error when I execute a procedure which accepts input paramters to insert into a table. I tried using TO_DATE(Input_param,'MM/DD/YY') too but it still gives me the error. Plz. Help.
> However if I make this modification in the values clause of the insert statement
and if I dont used "TO_DATE" function in the procedure call its giving me the above error.
SQL> values(
,TO_DATE(p_date,'DD/MM/YYYY'));
I'm not clear what modification you are making to what. If p_date is a DATE, there should not be a TO_DATE conversion applied to it inside the procedure - it's already a DATE.
How is your case different from the following example?
SQL> CREATE TABLE testit
2 ( id INTEGER, dateval DATE );
Table created.
SQL> CREATE OR REPLACE PROCEDURE testproc
2 ( p_id INTEGER
3 , p_dateval DATE )
4 AS
5 BEGIN
6 INSERT INTO testit (id, dateval)
7 VALUES (p_id, p_dateval);
8 END testproc;
9 /
Procedure created.
SQL> desc testproc
PROCEDURE testproc
Argument Name Type In/Out Default?
P_ID NUMBER(38) IN
P_DATEVAL DATE IN
SQL> exec testproc(1, sysdate);
PL/SQL procedure successfully completed.
SQL> exec testproc(2, DATE '2006-03-24');
PL/SQL procedure successfully completed.
SQL> exec testproc (3, TO_DATE('23/03/2006','DD/MM/YYYY'))
PL/SQL procedure successfully completed.
SQL> SELECT * FROM testit;
ID DATEVAL
1 24-MAR-2006
2 24-MAR-2006
3 23-MAR-2006
3 rows selected.If the procedure parameter is a DATE and the column is also a DATE, there should be no conversion involved. The "Not a valid month" error occurs when you try to convert a string to a DATE using either the wrong format or a nonsense string such as '2005-94-01'. You need to be clear what is a DATE and what is a string at each stage of processing.
Notice that the default date format can be changed:
SQL> ALTER SESSION SET nls_date_format = 'YYYY-MM-DD';
Session altered.
SQL> SELECT * FROM testit;
ID DATEVAL
1 2006-03-24
2 2006-03-24
3 2006-03-23
3 rows selected.
SQL> ALTER SESSION SET nls_date_format = 'RRRR-MM-DD HH24:MI:SS';
Session altered.
SQL> SELECT * FROM testit;
ID DATEVAL
1 2006-03-24 11:55:45
2 2006-03-24 00:00:00
3 2006-03-23 00:00:00
3 rows selected. -
Hi,
When i execute an insert statement i get ORA-01843 not a valid month error.
below is the SQL i try to execute in SQLPlus;
Insert into IKD$TA_L_FACHL_SCHRITT (FACHL_SCHRITT_ID, FACHL_SCHRITT_TEXT, VALID_FROM, VALID_TO) values (1,'LOAD_STG_TMD_ZUSATZDATEN' ,'19.08.2008','31.12.9999');
However if i execute the same in Oracle SQL developer it is working fine. Can someone please suggest what could be the reason for error in SQL PLUS ?
I suspect this to be the NLS_DATE_FORMAT setting issue, please correct if im wrong.
ThanksHi,
Never use a VARCHAR2 where a DATE is needed.
Use TO_DATE (with 2 arguments) to convert a VARCHAR2 to a DATE when necessary.
For example:
Insert into IKD$TA_L_FACHL_SCHRITT
( FACHL_SCHRITT_ID, FACHL_SCHRITT_TEXT, VALID_FROM, VALID_TO)
values ( 1, 'LOAD_STG_TMD_ZUSATZDATEN' , TO_DATE ( '19.08.2008'
, 'DD.MM.YYYY'), TO_DATE ( '31.12.9999'
, 'DD.MM.YYYY)
);The problem with implicit conversions is that they don't necessarily use the format you want them to.
Always use an explicit conversion function, and specify the format. -
sql server 2008 r2
RS2008 r2
I can execute the query in BIDS 2008 with out a problem and I can run on our RS2005 server without a problem
But when I deploy report and run on our RS2008 server I get the error
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'NIR'. (rsErrorExecutingCommand)
ORA-01843: not a valid month
QUERY:
select * from NIR_QUARTERLY where birth_date between :PARAM1 and :PARAM2
order by PT_CODECAUSE
The problem is caused by not using VALID dates values in the dataset.
- This data problem was masked in the original version as the Predicate(s) used can change between versions of Oracle
- Oracle does *not* guarantee the same explain plan or the specific order of predicates used between versions of Oracle
Reviewing the EXPLAIN PLAN for both versions revealed in this case:
1) The table was partitioned
2) The EXPLAIN PLANS were not the same due to how the partitions were accessed
3) If the same query was used against a non-partitioned table using the same data, the following error would always occur
ORA-01843: not a valid month
4) The problem string value was in this case found to include the string value of '0000-00-00'
The ORA-01843 occurred when using the TO_DATE function against '0000-00-00'
There is *no* Year= '0000' Month= '00' or day = '00' -- therefore the ORA-01843: not a valid month
--Prashanth
Maybe you are looking for
-
Can no longer view video files in Adobe Media Player!!
For some reason I can no longer view video files in Adobe Media Player. My computer has reverted all my files into one Adobe Flash Player document. Any help with this would be very appreciated. Thanks! Drivera
-
Change the Purchase Order : Item - Conditions value
Hi, How to change the Purchase Order : Item - Conditions value. In my PO, Item conditions shows the SKTO - Cash Discount value is 0. I want to change the Discount value 10. How can i change it??
-
I have created a WORD document using WORD 2007 and converted it to PDF. The document has hyperlinks and clickable bookmars but the regular IPAD PDF readers do not recgnize the links. Does anyone know what application for an IPAD would make the PDF li
-
How to fix gray background on images without checking "retain color depth"
I have a cover page on my report where the user can insert a logo image. The problem is that if the logo image has a white background it will turn the white background gray. I have figured out how to resolve this by checking "retain original image co
-
Is backing up and Restoring SharePoint 2013 Farm with SQL 2012 "Always On" High Availability now supported using "System Center 2012 R2 Data Protection Manager"? I cannot find confirmation anywhere. Regards, John