查询有点长
select user_aud_view.audit_id,
user_aud_view.user_id,
(users.last_name_txt || CHR(44) || users.first_name_txt) as user_name,
user_aud_view.column_name_txt,
user_aud_view.old_value_txt,
user_aud_view.new_value_txt,
case when evaluator.country_id like '%CAN%' then to_char(user_aud_view.audit_last_updated_dt,'YYYY/MM/DD HH12:MI:SS AM')
else to_char(user_aud_view.audit_last_updated_dt,'MM/DD/YYYY HH12:MI:SS AM') end as audit_last_updated_dt ,
user_aud_view.audit_updated_user_id,
evaluator.evaluator_name_txt,
evaluator.evaluator_id,
TRIM(TO_CHAR(to_evaluatortime(user_aud_view.audit_last_updated_dt,115) ,'Month'))||' '||TO_CHAR(to_evaluatortime(user_aud_view.audit_last_updated_dt,115) ,'dd'||','||' yyyy') AS DAILY_TXT,
trim(to_char(to_evaluatortime(user_aud_view.audit_last_updated_dt,115) ,'Month')) || ' ' || to_char(to_evaluatortime(user_aud_view.audit_last_updated_dt,115) ,'yyyy') AS MONTHLY_TXT,
decode(to_char(to_evaluatortime(user_aud_view.audit_last_updated_dt,115) ,'Q'),1,'January - March',2,'April - June',3,'July - September',4,'October - December') || ' ' || to_char(to_evaluatortime(user_aud_view.audit_last_updated_dt,115) ,'yyyy') AS QUARTERLY_TXT,
to_char(to_evaluatortime(user_aud_view.audit_last_updated_dt,115) ,'yyyy') AS YEARLY_TXT
from user_aud_view,
users,
evaluator
WHERE user_aud_view.evaluator_id = evaluator.evaluator_id
and user_aud_view.user_id = users.user_id
and user_aud_view.audit_last_updated_dt >= to_dbtime(to_date('07/01/2012', 'mm/dd/yyyy'),115) and user_aud_view.audit_last_updated_dt < to_dbtime(to_date('08/01/2012', 'mm/dd/yyyy'),115) AND ( (user_aud_view.evaluator_id = 115) ) ORDER BY user_id ASC, user_id ASC
它抱怨这一行的错误:
and user_aud_view.audit_last_updated_dt >= to_dbtime(to_date('07/01/2012',
'mm/dd/yyyy'),115) and user_aud_view.audit_last_updated_dt < to_dbtime(to_date('08/01/2012', 'mm/dd/yyyy'),115)
AND ( (user_aud_view.evaluator_id = 115) ) ORDER BY user_id ASC, user_id ASC
*
第 21 行的错误:ORA-01722:无效号码
但是,user_id 是一个 VARCHAR2 字段。
我不知道这些字段中的数据,因为我们无权访问该客户的数据库。