Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Please Help: ORA-01847 for valid date
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