Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Question about SQL query's behaviour
Hello,
Does someone have an idea about the behaviour described below ?
I create a view in Oracle V7 as follows :
CREATE OR REPLACE VIEW <ViewName>
(ProdMonth, ProdYear) AS SELECT TO_NUMBER(TO_CHAR(DS.SelectionDate,'MM')), TO_NUMBER(TO_CHAR(DS.SelectionDate,'YYYY')) FROM (SELECT DISTINCT TO_DATE(CONCAT('31/', TO_CHAR(<DateField>, 'MM/YYYY')),'DD/MM/YYYY') SelectionDate FROM <Table> WHERE TO_NUMBER(TO_CHAR(LAST_DAY(<DateField>),'DD')) >= 31) DS;
<Table> is a table that contains a date field <DateField>.
When i execute the query "select * from <ViewName>", i have the correct
result.
When i execute the query "select * from <ViewName> where ProdMonth = 8"
(or, another value), I have the following message :
ERROR:
ORA-01839: date not valid for month specified
Received on Tue Sep 05 2000 - 07:44:38 CDT
![]() |
![]() |