Not a valid month, but works from sql developer
Hi,
so this sample works from SQL DEV. :
insert into aspa2_magaddendum (contractid, addendum_number, from_date, to_date) values(2, 0, '03.05.2012', '24.05.2012');
but not from code using ODP.NET
string date1 = "03.05.2012";
string date2 = "24.05.2012";
OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)));User Id=aspa2;Password=aspa2;");
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.Parameters.Add("date1", date1);
cmd.Parameters.Add("date2", date2);
cmd.CommandText = "insert into aspa2_magaddendum (contractid, addendum_number, from_date, to_date) values(2, 0, :date1, :date2)";
cmd.ExecuteNonQuery();I get:
ORA-1843: not a valid month message from exception
Edited by: user2704811 on May 3, 2012 2:47 AM
Looks like SQL DEV. session is a bit different from the one in code...
From SQL DEV i get:
select value from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
"DD.MM.RR"
and from the code I get:
cmd.CommandText = "select value from nls_session_parameters where parameter = 'NLS_DATE_FORMAT'";
string format = cmd.ExecuteScalar().ToString();
"DD-MON-RR"
Similar Messages
-
File- Print not working from SQL Developer 1.2.1 Build MAIN-32.13
File->Print not working from SQL Developer 1.2.1 Build MAIN-32.13.
I downloaded sqldeveloper-1.2.1.3213.ZIP and extract to a local directory. From the extracted directory I ran ..\sqldeveloper\sqldeveloper.exe from Windows XP sp2. The program itself seems to run just fine but File-Print doesn't do anything. In Help-About, Java Platform is reported as 1.5.0_06 and Oracle IDE is 1.2.1.3213. I'm not sure where to look for what is causing the problem.
ThanksI hadn't tried CTRL-P before but I did today. On the first attempt, I saw a small jump in the memory usage for sqldeveloper.exe as reported in Windows Task Manager. Otherwise, there was no change. A second CTRL-P in the same session produced a further bump but subsequent attempts in the same session produced no further change in CPU or Memory Usage.
Using Task Manager to monitor this further, I tried File->Print again and saw that sqldeveloper would periodically climb to 1 or 2 percent CPU and consume a little more memory. After a minute or so, though, all activity stops again.
I do not get a print dialog box from SQLDeveloper using either CTRL-P or File->Print -
DB Link not working from SQL Developer
Hi All,
I Have two databases say A and B. My DBA has created a DB link and when he logs in to sqlplus directly on the server and he can get the values from the other database. When I'm to get the values from the other database through SQL Developer from my client machine, it is giving me ORA-12154: TNS :could not resolve the connection identifier specified.
I can access both the databases without any problem and i have the entries for bath in my TNSNAMES.ORA file.
Thanks in advance.
SKCheck the dblink ddl. your tnsnames.ora should have exact same word as dblink_authentication as below.
create public dblink dblink_name connect to username identified by password dblink_authentication; -
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 -
Hi,
I am trying to execute the following query on toad.
INSERT INTO BATCH_REQ(BATCH_TARGET, BO_TYPE, TRANSACTION_ID, TRANSACTION_DATA, TIMESTAMP, CHKSUM_FIELDVALU, SEQUENCE_ID)Values
('BATCH TARGET','BUSINESSOBJEXT','TRANSACTIONID','DATA','07/15/2010 02:47:46 PM','4','Sequence_ID')
this query is dynamically created by TIBCO to get the date time format as needed by oracle. I have executed in toad and tibco i am getting the same error.
ERROR:
BW-JDBC-100014 Job-192000 Error in [Batch Request Handler/Unit Test/Process Definition (1).process/SQL Direct]
"JDBC error reported: (SQLState = HY000) - java.sql.SQLException: [tibcosoftwareinc][Oracle JDBC Driver][Oracle]ORA-01843: not a valid month
caused by: java.sql.SQLException: [tibcosoftwareinc][Oracle JDBC Driver][Oracle]ORA-01843: not a valid month
I do understand by some reason, Oracle is not accepting the month, but when I see the date I am sending i feel its a valid month. ('07/15/2010 02:47:46 PM')
MM/dd/yyyy HH:mm:ss AM/PM
some where its wrong but i am unable to figure it out.
Any help is much appreciated.
ThanksYou (and your tool) really want to use a date value rather than a string when you do the insert. Relying on implicit data type conversion is going to be problematic.
The simplest option would be to use the TO_DATE function
INSERT INTO BATCH_REQ(BATCH_TARGET, BO_TYPE, TRANSACTION_ID, TRANSACTION_DATA, TIMESTAMP, CHKSUM_FIELDVALU, SEQUENCE_ID)Values
('BATCH TARGET','BUSINESSOBJEXT','TRANSACTIONID','DATA',to_date('07/15/2010 02:47:46 PM', 'MM/DD/YYYY HH:MI:SS AM'),'4','Sequence_ID')You could also change the NLS_DATE_FORMAT of the session (this needs to be done for each session)
ALTER SESSION SET nls_date_format = 'MM/DD/YYYY HH:MI:SS AM'That should cause the implicit conversion to do what you want. But if you have other scripts that depend on a different date format, those scripts would now break.
Justin -
Hi,
We developed OA page for Employee's Payslip and it is working fine for all the employees but it is not working for only one employee...Getting the error as
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement
preparation
## Detail 0 ##
java.sql.SQLException: ORA-01843: not a valid month
Real Scenario is:
The user "DANISH.LOTFY" is login into application and when he click on Payslip to the month then he is always getting the above error.
For testing purpose we have removed his employee assignment from user screen(fnd_user) and assigned some other employee name (say MOHAMED.ELBAHY)... After this when DANISH.LOTFY logins into the application and payslip page is working fine...(He can able to see MOHAMED.ELBAHY payslip.....
Realy we don't know this strange behaviour of OA ...
------ Code with Error details------------------
Statement:
SELECT * FROM (SELECT DISTINCT ppa.DATE_EARNED, TO_CHAR(ppa.DATE_EARNED,'MON-YYYY') DISPLAY
, TO_CHAR(ppa.DATE_EARNED,'MM YYYY') PARAM
FROM
pay_payroll_actions ppa
,pay_assignment_actions pac
,PER_ALL_ASSIGNMENTS_F PASS
,FND_USER FU
,per_time_periods PTP
WHERE ppa.payroll_id = 61
AND ppa.payroll_action_id = pac.payroll_action_id
AND PAC.ASSIGNMENT_ID = PASS.ASSIGNMENT_ID
AND PASS.PERSON_ID = FU.EMPLOYEE_ID
AND FU.USER_ID =Fnd_Profile.VALUE('USER_ID')
AND TRIM(TO_CHAR(ppa.DATE_EARNED,'MON-YYYY')) IS NOT NULL
---Added by Sudipta C on 28th Janaury 2008
AND TRIM(TO_CHAR(ppa.DATE_EARNED,'MON-YYYY')) <> TRIM(TO_CHAR(SYSDATE,'MON-YYYY'))
AND ppa.DATE_EARNED=(SELECT MAX(DATE_EARNED) FROM pay_payroll_actions WHERE time_period_id=ppa.time_period_id)
AND ppa.DATE_EARNED >='30-NOV-2007'
UNION ALL
--Query to Display only the Current Month if the Concurrent Request Ran
SELECT DISTINCT ppa.DATE_EARNED, TO_CHAR(ppa.DATE_EARNED,'MON-YYYY') DISPLAY
, TO_CHAR(ppa.DATE_EARNED,'MM YYYY') PARAM
FROM
pay_payroll_actions ppa
,pay_assignment_actions pac
,PER_ALL_ASSIGNMENTS_F PASS
,FND_USER FU
,per_time_periods PTP
WHERE ppa.payroll_id = 61
AND ppa.payroll_action_id = pac.payroll_action_id
AND PAC.ASSIGNMENT_ID = PASS.ASSIGNMENT_ID
AND PASS.PERSON_ID = FU.EMPLOYEE_ID
AND FU.USER_ID = Fnd_Profile.VALUE('USER_ID')
AND TRIM(TO_CHAR(ppa.DATE_EARNED,'MON-YYYY')) IS NOT NULL
AND TRIM(TO_CHAR(ppa.DATE_EARNED,'MON-YYYY')) = TRIM(TO_CHAR(SYSDATE,'MON-YYYY'))
AND ppa.DATE_EARNED=(SELECT MAX(DATE_EARNED) FROM pay_payroll_actions WHERE time_period_id=ppa.time_period_id)
AND ppa.DATE_EARNED >='30-NOV-2007'
--Check the Concurrent Program Ran or not to Display the SYS Month Payroll Period ID
AND EXISTS
(SELECT TRIM(TO_CHAR(REQUEST_DATE,'MON-YYYY')) FROM fnd_conc_req_summary_v fcrs
WHERE program_short_name = 'PROC_EXP1_TESTING'
AND PHASE_CODE='C' AND STATUS_CODE='C'
AND TO_CHAR(REQUEST_DATE,'MON-YYYY')=TO_CHAR(SYSDATE,'MON-YYYY')
AND REQUEST_DATE=(SELECT MAX(REQUEST_DATE) FROM fnd_conc_req_summary_v
WHERE CONCURRENT_PROGRAM_ID=fcrs.CONCURRENT_PROGRAM_ID))
ORDER BY 1 DESC) QRSLT WHERE (( UPPER(DISPLAY) like :1 AND (DISPLAY like :2 OR DISPLAY like :3 OR DISPLAY like :4 OR DISPLAY like :5)))
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormData(OAPageBean.java:2555)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1677)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
at oa_html._OA._jspService(_OA.java:84)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
at oracle.jsp.JspServlet.service(JspServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
at org.apache.jserv.JServConnection.run(JServConnection.java:294)
at java.lang.Thread.run(Thread.java:534)
## Detail 0 ##
java.sql.SQLException: ORA-01843: not a valid month
Could any please suggest/provide your valuable inputs to resolve this issue(It is in production , so please treat it as very urgent).
Thanks & Regards,
J.PrakashHi,
This is really a strange behaviour as you are saying that it is happening only for one user so please check his user preferences.
Regards,
Reetesh Sharma -
ERROR java.sql.SQLException: ORA-01843: not a valid month
This page is working fine for English Language. Once we change preference Lanuage to "French Candian" We are getting this issue.
This is little urgent on this.
ERROR
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: select
ppf.person_id,
ppf.employee_number,
god.organization_id,
ppf.full_name employee_name,
(select full_name from per_people_x where person_id = paf.supervisor_ID ) manager_name,
(select full_name from per_people_x where person_id = haou.attribute4 ) hr_name,
--hr_general.decode_person_name(haou.attribute4 ) hr_name,
haou.name organization_name,
GEM.termination_date actual_termination_date,
(select meaning from hr_lookups where lookup_type = 'LEAV_REAS' and lookup_code = GEM.Leaving_reason and enabled_flag = 'Y') leaving_reason,
god.sub_business sub_business,
god.business_segment business_segment,
god.industry_focus_group industry_focus_group,
pgd.segment2 corporate_Band,
tl.territory_short_name country
from per_people_f ppf,
per_assignments_f paf,
hr_all_organization_units haou,
per_grades pg,
per_grade_definitions pgd,
per_addresses pa,
fnd_territories_tl tl,
XXsm_org_dtl god,
XX_EXIT_TRANSACTION GET,
XX_EXIT_MANAGER GEM
where 1=1
and paf.person_id=:1
and paf.primary_flag='Y'
and ppf.person_id = paf.person_id
and paf.organization_id=haou.organization_id
and paf.organization_id = god.organization_id
and trunc(sysdate) between trunc(paf.effective_start_date) and trunc(paf.effective_end_date)
and trunc(sysdate) between trunc(ppf.effective_start_date) and trunc(ppf.effective_end_date)
and ppf.person_id=GET.employee_id(+)
and GET.Transaction_id = GEM.transaction_id
and paf.grade_id=pg.grade_id(+)
and pg.grade_definition_id=pgd.grade_definition_id(+)
and ppf.person_id=pa.person_id(+)
and pa.primary_flag(+)='Y'
and pa.country=tl.territory_code(+)
AND tl.language = USERENV('LANG')
AND trunc(sysdate) between trunc(pa.Date_from) and trunc(nvl(pa.Date_to, TO_DATE ('31-DEC-4712', 'DD-MON-YYYY')))
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:865)
at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:988)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:211)
at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:750)
at ge.oracle.apps.per.selfservice.eexit.employee.webui.GEExitEmployeeCO.processRequest(GEExitEmployeeCO.java:112)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:587)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1136)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2348)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1747)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:511)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:432)
at oa_html._OA._jspService(_OA.java:84)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
at oracle.jsp.JspServlet.service(JspServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
at org.apache.jserv.JServConnection.run(JServConnection.java:294)
at java.lang.Thread.run(Thread.java:619)
## Detail 0 ##
java.sql.SQLException: ORA-01843: not a valid month
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1119)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2566)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2963)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:584)
at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:631)
at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:518)
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3375)
at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(OAJboViewObjectImpl.java:828)
at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4507)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:574)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:544)
at oracle.jbo.server.ViewRowSetImpl.executeDetailQuery(ViewRowSetImpl.java:619)
at oracle.jbo.server.ViewObjectImpl.executeDetailQuery(ViewObjectImpl.java:3339)
at oracle.jbo.server.ViewObjectImplAre you hard coding anything in code or VO ?
AND trunc(sysdate) between trunc(pa.Date_from) and trunc(nvl(pa.Date_to, TO_DATE ('31-DEC-4712', 'DD-MON-YYYY')))Try some modification in the above nvl code and test.
And refer:
http://apps2fusion.com/apps/apps/430-string-to-date
-Anand -
SQL execution error, ORA-01843: not a valid month
Im using ASP/VBScript and its my first time starting to use Oracle as a DB provider.
Just having an issue with a statement that I have.
Heres my statement:
SELECT T592_NOON.SHIP_CODE, T592_NOON.REPORT_DATE, T592_NOON.L_B, T592_NOON.AVERAGE_SPEED, T592_NOON.SEASTATE, T592_NOON.DISTANCE, T592_NOON.WIND_DIRECTION, T592_NOON.IFO_MAIN, T592_NOON.IFO_BOILER, T592_NOON.IFO_AUXENGINE FROM T592_NOON WHERE (((SHIP_CODE)='S271') AND (REPORT_DATE BETWEEN to_date('08/02/2004 13:00:00', 'DD-MON-YYYY HH24:MI') and to_date('28/02/2004 18:15:00', 'DD-MON-YYYY HH24:MI')))
Whenever I run it it errors and returns:
SQL execution error, ORA-01843: not a valid month
Can anyone tell why this wouldnt work?
REPORT_DATE type is DATE
REPORT_DATE Sample data: 2003-04-28-12.00.00.000000Changing the format of the date seemed to fix it.
Incorrect: '08/02/2004 13:00:00'
Correct: '08-FEB-2004 13:00' -
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 -
SQL script works in SQL Developer but not when scheduled
I have a script that I can run, logged onto my server as a user with full permissions and into my database as SYSDBA, that produces a CSV file on the server when I run it from SQL Developer ON the server. HOWEVER, when I set it up as a scheduled job, using those SAME CREDENTIALS (same Windows/network user; same database user), I get no output. The job indicates that it's running successfully, but no file gets created.
Any advice is greatly appreciated.
Here's the script:
WHENEVER SQLERROR EXIT FAILURE;
set serveroutput on
DECLARE
my_query varchar2(5000);
BEGIN
my_query := q'[
SELECT client_id, JOB_NAME, SCHEDULE_TYPE, TO_CHAR(START_DATE,'MM/DD/YYYY HH24:MM') AS START_DATE,
REPEAT_INTERVAL, ENABLED, STATE, RUN_COUNT,
TO_CHAR(LAST_START_DATE,'MM/DD/YYYY HH24:MM') AS LAST_START, LAST_RUN_DURATION,
TO_CHAR(NEXT_RUN_DATE,'MM/DD/YYYY HH24:MM') AS NEXT_RUN
FROM DBA_SCHEDULER_JOBS
WHERE instr(client_id,'10.') is not null
ORDER BY LAST_START_DATE DESC
p2k.ccsd_any_query_to_csv('HRISEDB_E_OUTPUT_MK', 'dbserver_job_output.csv',my_query);
end;
=================================================================
Here's the called procedure (I don't really understand it -- I gleaned it from others on the internet):
-- DDL for Procedure CCSD_ANY_QUERY_TO_CSV
set define off;
CREATE OR REPLACE PROCEDURE "CCSD_ANY_QUERY_TO_CSV" (p_dir in varchar2, p_filename in varchar2, p_query in varchar2) AUTHID CURRENT_USER
is
l_output utl_file.file_type;
l_theCursor integer default dbms_sql.open_cursor;
l_columnValue varchar2(4000);
l_status integer;
l_query long;
l_colCnt number := 0;
l_separator varchar2(1);
l_col_desc dbms_sql.desc_tab;
l_col_type varchar2(30);
l_datevar varchar2(8);
BEGIN
l_query := 'SELECT SYSDATE FROM DUAL; ';
dbms_sql.parse(l_theCursor, p_query, dbms_sql.native);
dbms_sql.describe_columns(l_theCursor, l_colCnt, l_col_desc);
l_output := utl_file.fopen( p_dir, p_filename, 'w' );
dbms_sql.parse( l_theCursor, p_query, dbms_sql.native );
for i in 1..l_col_desc.count LOOP
utl_file.put( l_output, l_separator || '"' || l_col_desc(i).col_name || '"' );
dbms_sql.define_column( l_theCursor, i, l_columnValue, 4000 );
l_separator := ',';
end loop;
utl_file.new_line( l_output );
l_status := dbms_sql.execute(l_theCursor);
while ( dbms_sql.fetch_rows(l_theCursor) > 0 ) loop
l_separator := '';
for i in 1 .. l_colCnt loop
dbms_sql.column_value( l_theCursor, i, l_columnValue );
utl_file.put( l_output, l_separator || '"' || l_columnValue || '"');
l_separator := ',';
end loop;
utl_file.new_line( l_output );
end loop;
dbms_sql.close_cursor(l_theCursor);
utl_file.fclose( l_output );
execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
exception
when others then
execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
raise;
end;
/hello,
does oracle showing any errors in user_scheduler_job_run_details for this job ? I would advise try inserting some debug statement to identify where exactly its stuck. Also please check sample configurations syntax for user_scheduler_jobs.
Cheers
Sush -
On MacBook Air not work the Internet from iPad Wi-Fi mode, but work from iPad USB internet mode. Please help me. Thank)))
The following link has a Wi-Fi troubleshooting section for personal hotspot that may help: iOS: Troubleshooting Personal Hotspot
-
ORA-01843: not a valid month in sql loader
Hi. I am trying to insert time data into date column type and getting this one message ORA-01843: not a valid month.
My ctl configuration as follow:
TIME1 "TO_DATE(SUBSTR(:TIME1,1,19),'yyyy-mm-dd hh24:mi:ss')",
Data nature as follow:
19:43:52.0000000
Any help.
Regards
Irfan19:43:52.0000000 doesn't match the format picture yyyy-mm-dd hh24:mi:ss
perhaps you meant to use something like hh24:mi:ss and substr(:time, 1, 8) -
The database error text is: ORA-01843: not a valid month
I am trying to use a date field as a query filter and I keep getting the
following error:
A database error occurred. The database error text is: ORA-01843: not a
valid month. (WIS 10901).
When I remove the query filter and run the query it works as
expected. I want to be able to allow the users to use the date field in order
to select a date range. Can someone provide me with some information on how to
resolve this issue.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 -
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. -
XMLTable default values for timestamp results in ORA-01843: not a valid month
When I try to provide a default for a timestamp value in the XMLTABLE function, I am greeted with an error - ORA-01843: not a valid month - no matter how I provide that default value. Whether there is a value present in the XML or not is irrelavant for this bug to occur. It appears to be an incomplete fix of bug number 9745897 (thread).
select x.*
from
xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
COLUMNS dt timestamp default sysdate) x;
select x.*
from
xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
COLUMNS dt timestamp default systimestamp) x;
select x.*
from
xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
COLUMNS dt timestamp default to_char(systimestamp, 'YYYY-MM-DD"T"HH24:MI:SS') ) x;
Edit: A little more followup.
This works:
select x.*
from
xmltable('/DOC' passing xmltype('<DOC></DOC>')
COLUMNS dt date default sysdate) x;
This also works, except for its just the date, and not the date/time
select x.*
from
xmltable('/DOC' passing xmltype('<DOC></DOC>')
COLUMNS dt timestamp default sysdate) x;
This doesn't work
select x.*
from
xmltable('/DOC' passing xmltype('<DOC></DOC>')
COLUMNS dt timestamp default systimestamp) x;
ORA-01861: literal does not match format stringHi,
First of all, let's check the manual for the DEFAULT clause :
XMLTABLE SQL/XML Function in Oracle XML DB
The optional DEFAULT clause specifies the value to use when the PATH expression results in an empty sequence (or NULL). Its expr is an XQuery expression that is evaluated to produce the default value.
According to the documentation, the DEFAULT clause should specify an XQuery expression.
However, that is wrong, the actual implementation only expects an expression that resolves to a string, the content is not interpreted.
So, bottom line is if we don't directly specify a string, the expression will be implicitly converted to one, and we all know how bad things can go when implicit conversions occur, especially when dates or timestamps are involved.
Now let's focus on how the DEFAULT clause affects the query evaluation.
When a DEFAULT clause is specified, Oracle rewrites the projection differently and do not use the native xs:dateTime format to convert the value :
select x.*
from
xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
COLUMNS dt timestamp default systimestamp
) x
becomes :
SELECT CASE EXISTSNODE(VALUE(KOKBF$),'/DOC/DT')
WHEN 1 THEN CAST(TO_TIMESTAMP(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/DOC/DT')),50,1,2)) AS timestamp )
ELSE CAST(TO_TIMESTAMP(TO_CHAR(SYSTIMESTAMP(6)),'SYYYY-MM-DD"T"HH24:MI:SSXFF') AS timestamp )
END "DT"
FROM TABLE("SYS"."XQSEQUENCE"(EXTRACT("SYS"."XMLTYPE"('<DOC><DT>2013-08-14T15:08:31</DT></DOC>'),'/DOC'))) "KOKBF$"
See the red part : it doesn't use the format parameter, so the conversion relies on the session's NLS settings.
When there's no DEFAULT clause, the TO_TIMESTAMP function uses an explicit format :
select x.*
from
xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
COLUMNS dt timestamp --default systimestamp
) x
rewritten to :
SELECT CAST(
TO_TIMESTAMP(
SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/DOC/DT'),0,0,20971520,0),50,1,2)
, 'SYYYY-MM-DD"T"HH24:MI:SSXFF'
AS timestamp --default systimestamp
) "DT"
FROM TABLE("SYS"."XQSEQUENCE"(EXTRACT("SYS"."XMLTYPE"('<DOC><DT>2013-08-14T15:08:31</DT></DOC>'),'/DOC'))) "KOKBF$"
so yes, maybe there's a bug here.
Edit: A little more followup.
This works:
select x.*
from
xmltable('/DOC' passing xmltype('<DOC></DOC>')
COLUMNS dt date default sysdate) x;
Actually no, it doesn't work. Granted, maybe it doesn't produce any error, but the result is incorrect.
As explained, the conversion relies on the session NLS (NLS_DATE_FORMAT in this case) :
SQL> show parameters nls_date_format
NAME TYPE VALUE
nls_date_format string DD/MM/RR
SQL>
SQL> select sysdate from dual;
SYSDATE
16/08/13
SQL> select x.*
2 from
3 xmltable('/DOC' passing xmltype('<DOC></DOC>')
4 COLUMNS dt date default sysdate) x;
DT
13/08/16
Oracle first converts SYSDATE to a string using current NLS_DATE_FORMAT, resulting in '16/08/13'
Then this string is converted to a DATE using the xs:date format 'YYYY-MM-DD' resulting in 13/08/0016 (August 13, 0016) which is incorrect.
The obvious workaround to this issue is to control how Oracle implicitly converts from string to date/timestamp format :
SQL> alter session set NLS_TIMESTAMP_FORMAT= 'YYYY-MM-DD"T"HH24:MI:SS';
Session altered.
SQL> select x.*
2 from
3 xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
4 COLUMNS dt timestamp default systimestamp
5 ) x;
DT
2013-08-14T15:08:31
SQL> select x.*
2 from
3 xmltable('/DOC' passing xmltype('<DOC></DOC>')
4 COLUMNS dt timestamp default systimestamp) x;
COLUMNS dt timestamp default systimestamp) x
ERROR at line 4:
ORA-01861: literal does not match format string
SQL> select x.*
2 from
3 xmltable('/DOC' passing xmltype('<DOC></DOC>')
4 COLUMNS dt timestamp default cast(systimestamp as timestamp)) x;
DT
2013-08-16T12:32:58
Maybe you are looking for
-
IPod will no longer turn on or even charge. (5th Gen iPod)
One night I was using my iPod like I normally do. It was half way out of battery. I left my iPod on my bed and went to the kitchen. I got back in around 3 minutes. I went to grab my iPod and pushed the power button and it didn't turn on. I then press
-
I first noticed this after updating to version 13.x and today I updated to 14.x and hoped the problem would go away but it didn't. Since 13.x when I see files in the "Downloads" window, if I right-click on one, the "Open Containing Folder" is black (
-
RFC Receiver Adapter (Problem)
Hi All, I have configured RFC Receiver Adapter : Here i have imported a Z FM for example "" Z_API_DOCUMENT_CREATE_TEST "" having below import paramaters: LF_DOCNUMBER TYPE BAPI_DOC_DRAW-DOCUMENTNUMBER IV_PF_HTTP_DEST TYPE RFCDES-RFCD
-
Hi Guys I have a problem, when I try to make a return to vendor (sub-vendor), I got following error "Returns not possible for subcontracting items" when I create the return PO, did anyone know what is wrong. Best Regards Bang
-
Downloading Safari via Windows computer
Hi all I want to download the standalone installer of Safari 3.1 for Mac via a Windows computer, but all the links take me to the Windows download page. Does anyone have another link? Thanks Stefan