Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Question about SQL query's behaviour

Question about SQL query's behaviour

From: Paul van Dijken <paul.vandijken_at_sema.nl>
Date: Tue, 5 Sep 2000 14:44:38 +0200
Message-Id: <10610.116201@fatcity.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US