| SP2-0552: Bind variable "00" not declared. [message #202368] |
Thu, 09 November 2006 06:41  |
glkrr
Messages: 4 Registered: March 2005 Location: bangalore
|
Junior Member |
|
|
Hi All
I am getting following error while executing the below sql query at oracle.can any body please help.
SELECT * FROM
issues where sale_date = TRUNC(Mon Sep 11 20:00:00 EDT 2006);
Error :
SP2-0552: Bind variable "00" not declared.
|
|
|
|
| Re: SP2-0552: Bind variable "00" not declared. [message #202371 is a reply to message #202368] |
Thu, 09 November 2006 06:52   |
S.Rajaram
Messages: 1027 Registered: October 2006 Location: United Kingdom
|
Senior Member |
|
|
This information is cut and pasted from oracle documentation. this can also checked online at otn.oracle.com.
TRUNC (date)
Syntax
trunc_date::=
Description of the illustration trunc_date.gif
Purpose
The TRUNC (date) function returns date with the time portion of the day truncated to the unit specified by the format model fmt. The value returned is always of datatype DATE, even if you specify a different datetime datatype for date. If you omit fmt, then date is truncated to the nearest day. Please refer to "ROUND and TRUNC Date Functions" for the permitted format models to use in fmt.
Examples
The following example truncates a date:
SELECT TRUNC(TO_DATE('27-OCT-92','DD-MON-YY'), 'YEAR')
"New Year" FROM DUAL;
New Year
---------
01-JAN-92
Any value prefixed by a ":" is treated as a bind variable if it is not enclosed in quotes. So try to solve this by yourself.
|
|
|
|
| Re: SP2-0552: Bind variable "00" not declared. [message #202372 is a reply to message #202368] |
Thu, 09 November 2006 06:54  |
 |
Littlefoot
Messages: 21826 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
It is because colon (:) shows Oracle that 00 is a bind variable. You, probably, didn't want to do that. What you really need is to truncate DATE. We usually represent dates by a character string and enclose it into single quotes, such as '11.09.2006. 20:00:00'. This doesn't mean much to Oracle - it is much more happy when you (a developer) put it the way it uniquely knows what you meant. Therefore, use appropriate function and format mask:
TO_DATE('11.09.2006. 20:00:00', 'dd.mm.yyyy. hh24:mi:ss')
Once you have a DATE value, truncate it to desired precision using the TRUNC function.
|
|
|
|