Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bind variables and dates

Fermat deOct 20 2014 — edited Oct 21 2014

I am writing a process to delete records based on dates.

Here is the table:

Column NameData TypeNullableDefaultPrimary Key
IDNUMBERNo- 1
CT_NAMEVARCHAR2(100)Yes- -
CT_CATEGORYVARCHAR2(100)Yes- -
BASE_PTSNUMBERYes- -
PROD_PTSNUMBERYes- -
REF_PTSNUMBERYes- -
START_DATEDATEYes- -
END_DATEDATEYes- -
CREATED_ONDATEYes- -
CREATED_BYVARCHAR2(50)Yes- -
UPDATED_ONDATEYes- -
UPDATED_BYVARCHAR2(50)Yes- -

with start_date and end_date being the key date fields.

The query will delete dates with specific start and end dates.  The issue I am having is that I keep getting a ORA-01858: a non-numeric character was found where a numeric was expected error when the query executes.

delete from ct_point_values

where start_date=:P4_START_DATE_V

and end_date=:P4_END_DATE_V

If I run the query in the sql window, no problem:

delete from ct_point_values

where start_date='1/1/2014'

and end_date='12/31/2014'

The query with the hard coded values works find.  Binds fail.  I have tried variations of casting, to_char and to_date with no luck.

One thing I do notice is that when I return to enter my bind variables in the sql workshop, the fields are pre-populated with this:

1/1/2014

12/31/2014

for 1/1/2014 and 12/31/2014.  The only item I have found relates to this suggests it is a possible bug:

SQL Workshop Bind Variables - Date Issues

Any thoughts on how to address this, or is this really a bug?

I am running on Apex 4.2, 11g.

Thanks!

This post has been answered by Luis Cabral on Oct 21 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 18 2014
Added on Oct 20 2014
5 comments
2,862 views