如何在预言机中将长数据转换为字符 ||ORA-00932:数据类型不一致:预期的 CHAR 变长



我正在尝试执行下面的查询,该查询根据几个标准获取不同的数据。在这里,我在 cookie 字段上使用了类似运算符,我的 cookie 字段是长数据类型。

select * from (
select to_char(audit_logs.REQUEST_TIME, 'dd/mm/yyyy HH24:mm:ss') as event_time,
audit_logs.CLIENT_REQUEST as client_request,
audit_logs.RESPONSE_CODE as responsecode,
audit_logs.SIZEOFOBJECT as sizeofobject,
audit_logs.COOKIES as cookies,
audit_logs.ENV as env,
audit_logs.USERID as user_id,
audit_logs.POST_DATA as post_data,
audit_logs.AUTHSCHEME as authscheme,
audit_logs.AUTHMARKET as authmarket,
audit_logs.X_REQUESTED_WITH as x_requested_with,
audit_logs.METHOD_TYPE as method_type,
audit_logs.HOSTNAME as hostname,
audit_logs.SESSION_COOKIES as session_cookies,
audit_logs.X_FORWARDED_FOR as x_forwarded_for,
audit_logs.USER_AGENT as user_agent,
audit_logs.GEOIP_COUNTRY_CODE as country_code
from audit_logs
where
REQUEST_TIME >= to_date(:fromdate,'dd/mm/yyyy')
and REQUEST_TIME <= to_date(:todate,'dd/mm/yyyy HH24:MI:SS')
and COOKIES LIKE '%TANID=%'
order by REQUEST_TIME DESC)
where ROWNUM <= :recordslimit
order by event_time DESC;

执行上述查询时,我收到以下错误:

ORA-00932: inconsistent datatypes: expected CHAR got LONG
00932. 00000 -  "inconsistent datatypes: expected %s got %s"

有人可以请问如何解决这个问题。

注意:更改数据类型将是一项耗时的工作,因为我的数据库包含大量数据。

您将在查询中定义三个命名参数 - fromdate、todate 和 recordslimit。查询对 fromdate 和 todate 参数使用to_date,因此它们应为 char 数据类型。因此,请检查您在传递这些参数的实际值时使用的实际数据类型。可能还有其他渔获,但这是我唯一能想到的。

相关内容

  • 没有找到相关文章