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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Please Help: ORA-01847 for valid date

Re: Please Help: ORA-01847 for valid date

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Tue, 22 Feb 2005 11:46:23 -0800
Message-ID: <1109101403.620395@yasure>


wdewebserver wrote:

> Hi
>
> I have written the following stored procedure hoping to extract data from a
> table. When I call the stored proc using a date like 10-11-2004, I get an
> error ORA-01847: day of month must be between 1 and last day of month.
>
> Procedure "dynamic"
> (
> vTABLE_NAME IN CHAR,
> vCREATED_DATE IN CHAR,
> vREF_CURSOR OUT GLOA.RCT
> )
> AS
> V_STRING VARCHAR2(1000);
> BEGIN
> V_STRING := 'SELECT XRED, YFER FROM '||vTABLE_NAME||' '||
> 'WHERE CREATED_DATE = TO_DATE('||vCREATED_DATE||',''DD-MM-YYYY'')'
>
> OPEN vREF_CURSOR FOR V_STRING;
> END dynamic;

Change CHAR to VARCHAR2. Likely you are padding vTABLE_NAME and v_CREATED_DATE out to 2000 bytes.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Tue Feb 22 2005 - 13:46:23 CST

Original text of this message

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