Given query giving an error -invalid month????
select to_date(add_months(trunc(sysdate),-5) ||' 10:30:00 AM','mm/dd/yyyy hh:mi:ss am') from dual
giving an error-invalid month..
1. Instead of comma you have put dot.
2. Below is teh correct usage
select to_date(to_char(add_months(trunc(sysdate),-5),'DD/MM/YYYY')||' 10:30:00 AM','DD/MM/YYYY HH:MI:SS AM')
from dual3. But, why are you going for this when there is a straight forward way?
Similar Messages
-
Adding a Custom Hierarchy field to SPM query giving Server Error
Hi
I have enahnced the SPM data model with Organistaion Unit Infobject 0ORGUNIT as part of a
enhancement requirement for using 0ORGUNIT Hierarchy .
The field has been added to Bex Query - Spend Analysis Final and also appear in the SPM datasource.
When I add this 0ORGNUNIT field to the SPM report in SPM UI , I get a server error.
There isn't anymore information showing up about the error.
I dont think I missed any step here . I a;lso checked the Analysis administration - Dimension Properties and all looks fine there.
I can see the new field 0ORGUNIT showing up with Hierarchy selected.
We are in SPM 3.0 support pack 7.
Appreciate your quick help in this.
Thanks
Rettna KumarHi,
Please check whether your key flex structure is frozen or not. If now please freeze it and re compile and try.
This may helps too
error while developing KFF in oaf
Thanks
Bharat
Edited by: Bharat on May 10, 2013 4:51 AM -
Query giving compilation error
hi,
i am confused that my query is working fine on back-end sqlplus, but as i put to use it in my form
at pre-form to know count, it gives compilation error;
sqlplus
SELECT COUNT(*) M_CNT1
FROM(
SELECT POH_CODE||'-'||POH_NO CODE,NVL(POH_FREIGHT_lc_amount,0)
-NVL((
SELECT SUM(FTH_LC_AMOUNT)
FROM FIN_TXN_HEADER
WHERE FTH_REF_CODE = POH_CODE
AND FTH_REF_NO = POH_NO
AND FTH_ACNT_CODE = 'AC1009'
GROUP BY FTH_REF_CODE,FTH_REF_NO),0) NET, POH_CODE, POH_NO
FROM PURCHASE_ORDER_HEADEr
WHERE NVL(POH_FREIGHT_LC_AMOUNT,0) > 0);
M_CNT1
1
in pre-form
declare
m_cnt1 number;
BEGIN
SELECT COUNT(*) INTO M_CNT1
FROM(
SELECT NVL(POH_FREIGHT_lc_amount,0)
-NVL((
SELECT SUM(FTH_LC_AMOUNT)
FROM FIN_TXN_HEADER
WHERE FTH_REF_CODE = POH_CODE
AND FTH_REF_NO = POH_NO
AND FTH_ACNT_CODE = 'AC1009'
GROUP BY FTH_REF_CODE,FTH_REF_NO),0) NET
FROM PURCHASE_ORDER_HEADER
WHERE NVL(POH_FREIGHT_LC_AMOUNT,0) > 0);
END;return error;
Error 103 at line 11, column 2
Encountered the symbol "SELECT" when expecting on of the following:
( - + mod not null others<an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
cast<a string literal with character se specification>
<a number> <a single-quoted SQL string>
Error 103 at line 16, column 36
Encountered the symbol "," when expecting on of the following:
) intersect minus union
i think the problem is continuation line or single quote.
what is it can anybody help me please? tyvm.>
Error is in this line.
Use : before M_CNT1hi Navneet,
m_cnt1 is neither a db-or-a-non-db-block item.
so how come i used : sign before m_cnt1.
i guess the problem is below sonewhere may be,
-NVL((
SELECT SUM(FTH_LC_AMOUNT) --- line 11
OR
GROUP BY FTH_REF_CODE,FTH_REF_NO),0) NET --line 16 -
Multi-row sub query returns ORA-00904 :invalid identifier error
I am creating a report from two tables that I am not joining. I want a single line for every row in table1 that meets a date range. Table2 can contain none or many rows for each recored in table1. I want to get up to two fields from table2.
I was using a case statement to check if there was data and then an in-line query or subquery. Once again, the idea is to have a single line on the report for each table1 record.
I get this error with the code below. It seems the nested multi-row subquery can not see the a.cr_mas_cr_no identifier.
ORA-00904: "a"."cr_mas_cr_no": invalid identifier
Any help is greatly appreciated,
Sam
select
a.cr_mas_cr_no "CRNO", a.cr_mas_type "TYPE", a.cr_mas_status "CR Status",
a.cr_mas_date_logged "Logged date", a.CR_REL_REQ_APP_DATE "RTP approved",a.CR_REL_REQ_RTP_DATE "RTP Date",
a.cr_accepted_date "Complete", a.cr_mas_submitted_by "Requester",
select doc_user FROM crrm_cr_documents WHERE doc_cr_number =a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'BD' ) "Bus Design",
(select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TD' ) "Tech Design",
(select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TE' ) "User acceptance test",
case
when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 0
then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
end
"RTP #1",
case
when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 1
then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 2)
end
"RTP #2",
a.CR_REL_REQ_RTP_BY "Released by",
a.CR_ACCEPTED_BY "Post RTP User Acceptance",
a.cr_mas_title "Title", a.cr_mas_id "ID"
from
crrm_crmaster a
where
(a.CR_REL_REQ_RTP_DATE >= :P1109_BEGDATE and (a.CR_REL_REQ_RTP_DATE <= :P1109_ENDDATE) and
(a.cr_mas_status = 'Complete' or (a.cr_mas_status = 'Release Approved'and a.CR_REL_REQ_APP_DATE < :P1109_ENDDATE))
Message was edited by:
slavanawayIceman,
Thanks for the reply I will try your suggestion.
I will try and explain why I think two subqueries (an in-line query with a subquery?) are required. I will use the creation of the column RTP #1 as the example as the RTP #2 column is only different in the rownum selected.
Looking only at the lines that fail, here is my analysis. (If I rem out the two case lines the query runs, I just don't get two columns of data I need.) I will only examine the first case as the second is changed to extract the second approval via the rownum = 2 criteria. The first statement checks there is at least one RTP approval stored for the request and then gets the user who approved the request if the test is true.
case when
(select count(appr_user) from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') > 0
then
The above part works fine and the correct count of approvals is returned.
(select appr_user from (select * from crrm_cr_approvals where appr_cr_no=a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
end
"RTP #1",
I moved the parenthesis to the correct location. There can be multiple approvals for a given parent record. Some parent records need one, some need two approvals. If I replace
(select appr_user from (select * from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
with
(select appr_user from approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP' and rownum = 1)
The correct result is returned because it returns exactly one row as rownum=1 limits the query. When rownum = 2 then the query returns null as the rownum never gets to two as the rownum column is built via the set created by the second subquery.
The subquery builds a set of approvals for a specific "cr_no" and appr_type of "RTP". the outer query then looks at the rownum of the second query
Here is where I got the rownum information from;
http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
So here is what I think is happening;
1. Main query From and Where are processed. This should provide the "set" for the query
2.The from subqueries for RTP #1 and RTP #2 should be able to access the a.cr_mas_cr_no field and build a set from the approvals table.
3.The RTP #1/2 subquery (inline maybe a better description?) would then get the correct row from the from subquery.
The error "invalid identifier" refers to the a.cr_mas_cr_no field. I assume it means it can not resolve the table alias inside the subquery.
So maybe your grouping would help, I will try.
Sam -
Invalid month error sometimes in SQL Developer
Hi
sometimes I get 'Invalid Month error' in SQL developer when I execute the following query
select TRUNC(TO_DATE('01-JUN-2013','DD-MON-YYYY')) from dual;
But when I dosconnect session and reconnect, It works fine
Any suggestions on how to avoid this issue ?
Thanks872202 wrote:
Hi
sometimes I get 'Invalid Month error' in SQL developer when I execute the following query
select TRUNC(TO_DATE('01-JUN-2013','DD-MON-YYYY')) from dual;
But when I dosconnect session and reconnect, It works fine
Any suggestions on how to avoid this issue ?
ThanksThere's absolutely no reason that that should result in that error.
The SQL is sent to the database and it's perfectly valid SQL, taking a string, and converting it to a date with the correct date format mask, and then truncating the date (which, by default is to the day, which in this case is pointless as it's already truncated), returning a DATE datatype, which SQL Developer will then render using it's date display format. -
Invalid month error in WEBI report level
Hi,
I had a issue with date format.I am using oracle10g as a backend database.I have a date object in universe level i used that object in web intelligence report level.I created prompt for date object after select the date from the list i am getting " invalid month error". In database level object datatype is timestamp.
How to solve this issue.can somebody help me to solve the problem.Hi
Date Objects depends on various formats for different database
Make sure that u format date like MM/dd/yyyy in universe level . and the object should be in date datatype .
In the query level use prompt to select dates.
In report level
create a variable and use a formula like
todate(userresponse("Enter date");"")
Hope this helps U
Sunil -
I am new to SSRS and I am trying to migrate reports from 2008 to 2012. As I have so many reports to migrate, I simply got the back up of ReportServer,
ReportServerTempDB, and Encryption Key and restored them to test environment. I made necessary configuration from RS configuration tool. I am able to see the reports now when I browse //hostname/reports. But when I open any particular report I am getting some
error.
· An error has occurred during report processing.
(rsProcessingAborted)
Query execution failed for dataset 'dataSet'.
(rsErrorExecutingCommand
Semantic query execution failed. Invalid object name
'RPT. ******'. (rsSemanticQueryEngineError)
****** - I am assuming this is a custom data class.
Does anyone have insight on this? or any better way that I can migrate the reports to new server with less efforts.
I don’t have the reports solution file to deploy the reports, so I have followed backup and restore process.Hi Kishore237,
According to your description, you migrated some reports from Reporting Services (SSRS) 2008 to 2012. Now you get error when accessing the reports on SSRS 2012. Right?
In this scenario, did you modify the report data source in database after migration? You can try to open the report in Report Builder or Report designer and check the report dataset. If you can preview the report in Report builder or Report designer,
please try to redeploy the report to Report Server. If it is still not working, please try to restore the database from backup. And for migrating reports, please follow the "Content-Only Migration" in the link below:
http://msdn.microsoft.com/en-us/library/ms143724(v=sql.110).aspx
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Query giving run time error.
Hi BW Experts,
Here goes my question :
There is a query which is giving runtime error as time limit exceeded. This query is based on an infoset which is based on 4 ODS's.
Is there any way we can do performance tuning for this query?
Many Thanks in advance,
Sudip.Hi Ganesh,
Thanks for your help.
Can you please tell me which option to select for the infoset query as i'm seeing a lot of options on the left hand side of the screen like master Data, Transaction data, ODS objects,PSA tables etc for the RSRV transaction?
Also to add-on from my first post...this particular query is executing for an hour after which the error message comes an "System Failue, Time limit exceeded".
Regards,
Sudip. -
Strange invalid month error.
Hi all,
I have a function which receives a date and then returns a text string saying what day of the week it is, ie Monday Tuesday etc etc
For example sakes I'll say the function is called dayoftheweek and we use the function like 'select somedate, dayoftheweek(somedate) from dual'
Now, the bit within the function that works out the day is as below
SELECT TO_CHAR(TO_DATE(p_date, 'DD/MM/RRRR') ,'DAY') from dual (p_date is the internal function variable for the date passed in.)
Now, if I do this
select dayoftheweek('25-MAY-09') from dual -- this works.
But...
select dayoftheweek('25/05/09') from dual -- this does not work, I get an ora 01843 invalid month error.
So, I assumed it was something to do with the logic that worked out the day of the week.
However, the below works.
SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR') ,'DAY') from dual
Does anyone know why when passing a date to the function in format 'select dayoftheweek('25/05/09') from dual' does not work but if I use this format within the function logic as above it does work?
Cheers,
rgHello,
Oracle does not know your date format:
select dayoftheweek('25/05/09')I.e, it does not know that the date you are passing in is in the form of 'DD/MM/MM'. You must tell it (since it isn't your default format):
select dayoftheweek(to_date('25/05/09', 'DD/MM/YY'))If all you wanted, however, was the day of the week from a date, then:
TO_CHAR(to_date('25/05/09', 'DD/MM/YY'), 'DAY')Will give you that.
And by the way, this:
SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR') ,'DAY') from dualIs correct by chance, even though you're getting no error you may get the wrong result, because you're telling oracle you're passing in 4 digits for the year, yet you're only passing in two.
Edit Beware:
SQL> SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR'), 'YYYY') from dual;
TO_C
2009
SQL> SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/YYYY'), 'YYYY') from dual;
TO_C
0009 -
I have seen a thread on this topic. But my issue is a bit different.
I have a table (suppose A) with a date column (let b B)
There is a view on this table say A_V. This view simply queries the table A.
I have another table C, to which I am inserting record from A_V in a for loop like
FOR i IN (SELECT * FROM A_V)
LOOP
INSERT INTO C(x,y,B)
VALUES( i.x,i.y,nvl(i.B,sysdate) );
END LOOP;
I found invalid month issue in it. I am not sure of the reason. However, do I need apply to_char on i.B or nvl(i.B,sysdate) to give it a specific format. And if so, how would I know what format I should apply.
I was also doing some test plsql developer and found result like this. Can anyone help me understand.
select id,nvl(to_char(DATE_DATA,'dd/MM/yyyy'),to_date('19000101','YYYYMMDD')) from DATA_DUMP
where DATE_DATA is null
result is
1 361725 01-JAN-00
2 800001 01-JAN-00
3 800002 01-JAN-00
4 420068 01-JAN-00
5 442682 01-JAN-00
6 442984 01-JAN-00
7 442340 01-JAN-00
select id,nvl(DATE_DATA,to_date('19000101','YYYYMMDD')) from DATA_DUMP
where DATE_DATA is null
1 361725 1/1/1900
2 800001 1/1/1900
3 800002 1/1/1900
4 420068 1/1/1900
5 442682 1/1/1900
6 442984 1/1/1900
7 442340 1/1/1900
I get similar result with DATA_DATA not null too.
-Debp.s. you also don't need to do your insert as single inserts within a cursor loop as this will give you poor performance. It should be done as a single insert... select... statement.
e.g.
SQL> select * from a;
EMPNO DEPTNO B
7369 20 17/12/1980 00:00:00
7499 30 20/02/1981 00:00:00
7521 30 22/02/1981 00:00:00
7566 20 02/04/1981 00:00:00
7654 30 28/09/1981 00:00:00
7698 30 01/05/1981 00:00:00
7782 10 09/06/1981 00:00:00
7788 20
7839 10 17/11/1981 00:00:00
7844 30 08/09/1981 00:00:00
7876 20
7900 30 03/12/1981 00:00:00
7902 20 03/12/1981 00:00:00
7934 10 23/01/1982 00:00:00
14 rows selected.
SQL> create table c (empno number, deptno number, b date);
Table created.
SQL> insert into c
2 select empno, deptno, nvl(b,sysdate)
3 from a;
14 rows created.
SQL> select * from c;
EMPNO DEPTNO B
7369 20 17/12/1980 00:00:00
7499 30 20/02/1981 00:00:00
7521 30 22/02/1981 00:00:00
7566 20 02/04/1981 00:00:00
7654 30 28/09/1981 00:00:00
7698 30 01/05/1981 00:00:00
7782 10 09/06/1981 00:00:00
7788 20 09/01/2009 15:24:04
7839 10 17/11/1981 00:00:00
7844 30 08/09/1981 00:00:00
7876 20 09/01/2009 15:24:04
7900 30 03/12/1981 00:00:00
7902 20 03/12/1981 00:00:00
7934 10 23/01/1982 00:00:00
14 rows selected.
SQL> -
I am using jcreator where i am getting this error while compiling
Error : Invalid path, "C:\Program Files\Java\j2re1.4.2_05\bin\javac.exe" -classpath "C:\Program Files\Xinox Software\JCreatorV3LE\MyProjects\zeroCode\classes" -d C:\Program" Files\Xinox "Software\JCreatorV3LE\MyProjects\zeroCode\classes C:\Program" Files\Xinox Software\JCreatorV3LE\MyProjects\zeroCode\src\BasicServiceLister.java
Instead of that same program is compiling in textpad/eclipse easily.
Please tell me what should i do to set what.
present settings are:
User Variable:
classpath C:\Program Files\Xinox JCreatorV3LE\MyProjects\zeroCode\ classes
Java_HOme: C:\Program Files\Java\j2re1.4.2_05\bin\javac.exe
Path:C:\Program Files\Java\j2re1.4.2_05\bin
Classpath is System Variables:
C:\Program Files\Xinox Software\JCreatorV3LE\MyProjects\zeroCode\ classes
Path :C:\Program Files\Java\j2re1.4.2_05\bin
wher i really need to modify the settings:
May be thorugh command prompt.
I never did. windowds environment varaibles i can set.
Thanks
Vijendra... -d C:\Program" Files\Xinox "Software\JCreatorV3LE\MyProjects\zeroCode\classes ...
Looks like you are typing in things wrong with the double quotes. -
I have purchased three different audiobooks and none of them will download. It keeps giving me error 3259. It will let me download tv shows no problem. What is the problem?
<after three tries, decided that it's just not worth responding to>
-
In the below procedure
While creating the cursor(CURSOR C_CURSOR IS) its giving an error ORA-00900: invalid SQL statement
CREATE OR REPLACE PROCEDURE CCNN
IS
AUTO VARCHAR2(10);
V_in_ID CYEAR.CY_ID%TYPE;
V_STARTDATE CYEAR.STARTDATE%TYPE;
V_ENDDATE CYEAR.ENDDATE%TYPE;
BEGIN
SELECT STARTDATE INTO V_STARTDATE FROM Table1 WHERE US ='C';
SELECT ENDDATE INTO V_ENDDATE FROM Table1 WHERE US ='C';
CURSOR C_CURSOR IS
SELECT aa.a_NUMBER FROM TABLE10
Where MONTHS_BETWEEN(TO_DATE(V_STARTDATE ,'YYYYMMDD'), AND aa.a_NUMBER IN
( SELECT C_NUMBER FROM Table 10 WHERE
(EXTRACT (MONTH FROM TO_DATE(STARTDATE,'YYYYMMDD')) =
EXTRACT (MONTH FROM TO_DATE(STARTDATE,'YYYYMMDD')))
UNION( select query))
END
END CCNN;
ORA-00900: invalid SQL statementwhy is your cursor not in declaration section?
SQL> create or replace procedure abc as
2 a NUMBER ( 10 );
3 CURSOR c1
4 IS
5 SELECT 1
6 FROM DUAL;
7 BEGIN
8 null;
9 END;
10 /
Procedure created.
SQL> create or replace procedure abc as
2 a NUMBER ( 10 );
3 BEGIN
4 CURSOR c1
5 IS
6 SELECT 1
7 FROM DUAL;
8
9 END;
10 /
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE ABC:
LINE/COL ERROR
4/13 PLS-00103: Encountered the symbol "C1" when expecting one of the
following:
:= . ( @ % ;
9/1 PLS-00103: Encountered the symbol "END" when expecting one of the
following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
SQL> create or replace procedure abc as
2 a NUMBER ( 10 );
3 BEGIN
4 DECLARE
5 CURSOR c1
6 IS
7 SELECT 1
8 FROM DUAL;
9 BEGIN
10 NULL;
11 END;
12 END;
13 /
Procedure created.Message was edited by:
Chaitanya.S.S.K -
Installing Bundle#1 in peoplesoft but it giving me error
Hi,
I want to install and ofigure SAIP, i have followed peoplebook for this purpose. It is written there that install Campus Solutions 9.0 Bundle #9 (or the multilingual version) and HCM 9.0 Maintenance Pack #4. For this i have downloaded all the required Bundles into my system. I ran change assistant and given all the files to it, it runs and after a little time giving me error that:
Invalid command in boot strap mode
Ended: Sat Feb 18 18:03:30 2012
Unsuccessful completion
i am unable to find such error resolutions on forums and over the other useful sites.
Please help me to out of this, because i have dead line which is very near and i have to implement SAIP.
Regards
Zubair AliZubair wrote:
HCM 9.0 Maintenance Pack #4.
Campus Solutions 9.0 Bundles #7 and #8.
Apply Incident Resolution 768436.
My question is what will be the sequece of all Bndle and MPs? SHoud i install Mps first and then bundle? or i go with Bundles first and then Mps?The MP5 has been released and if I'm not wrong the MP5 cumulative includes all the bundles up to bundle #7. So, why not go for that MP5 then apply bundle #8 ?
Of course, you should check the prerequisites if any.
Nicolas. -
(NOLOCK) is giving syntax error
Hi,
I have query which runs properly in 1 server and in the other server it gives syntax error because of (NOLOCK).
When i remove (NOLOCK) its working fine.
my query is a big one...
But it is something like
INSERT INTO @abc
SELECT a.id,SUM(b.count) FROM
(SELECT DISTINCT id FROM table1 (NOLOCK)) AS a
INNER JOIN Table2 (NOLOCK) AS b
GROUP BY a.id
It is giving syntax error at only one (NOLOCK) that is near Table2 in one server and in other server it works fine...
Both the server versions are exactly same...
What is the reason?First, it is generally a bad idea to post a follow-up "me, too" response to an old and answered question. Fewer people will look at an answered question generally.
Next, the reason this thread provides no information about the original problem and the solution is because the complete problem was not posted. If your query generates an error message, it is important to see the complete and actual error message.
Given the conversation, it is likely that there was a syntax error in the various statements that OP tried and it was a happy accident that the removal of the hint caused the error to go away.
Lastly one should refrain from using hints generally. For some unfathomable reason there is a myth that it is a good practice to use the nolock hint.
Maybe you are looking for
-
Today only, Stocks and Weather incredibly slow...
Getting info for either app is taking far longer than usual and has occurred on 2 Touch's we own, with no other wifi apps affected. Anyone else notice that today, Stocks and Weather are very slow to update? They are taking about 15-25 seconds instead
-
Photos in library missing from Events? I have a solution
This is a continuation from an answered question here: https://discussions.apple.com/message/15830476#15830476, but with a new twist and a solution that I found myself. Hope it helps others: After doing a corrupt library rebuild, I noticed some photo
-
Downloading (Exporting) Logo from SE78 in 4.7
How can I download the logo? Please provide steps. I am using OAOR but I am not getting it since I am new to it. Its exporting it as FILE0001 with no format. Thanks Edited by: saad A on May 19, 2009 5:00 PM
-
Hi, I've just renamed an entity object. Jdeveloper renamed the java files for me. I work with CVS. How do I tell CVS to remove the old file and add the new file after a rename? (I can do it manually ofcourse with the CVS command line, but I'd like to
-
dear all, When i am accessing one of my aaa client , which is getting authenticated from ACS Server 4.2 it is showinng as Authorization failure , what could be the issue configuration on device &server side is proper