描述字段上的数据类型错误不一致

时间:2015-01-22 11:14:35

标签: sql oracle oracle-sqldeveloper

我正在尝试运行以下代码来查询我的数据库并将一些行转换为列。

代码很大程度上有效,但出于某种原因我收到以下错误:

ORA-00932:不一致的数据类型:预期 - 获得CLOB 00932. 00000 - “不一致的数据类型:预期%s获得%s”

这是我的代码:

select * from (

select 

j.project_key
,j.issue_type
,j.assignee
,j.reporter
,j."SUMMARY"
,j.priority
,j.status
,j.date_created
,to_char(next_day(j.date_created,'sunday'),'iw') as "Created Week"
,to_char(j.date_created, 'MON' ) as "Created Month"
,to_char(j.date_created, 'YYYY' ) as "Created Year"
,j.date_updated
,to_char(next_day(j.date_updated,'sunday'),'iw') as "Updated Week"
,to_char(j.date_updated, 'MON' ) as "Updated Month"
,to_char(j.date_updated, 'YYYY' ) as "Updated Year"
,j.date_resolved
,to_char(next_day(j.date_resolved,'sunday'),'iw') as "Resolved Week"
,to_char(j.date_resolved, 'MON' ) as "Resolved Month"
,to_char(j.date_resolved, 'YYYY' ) as "Resolved Year"
,j.due_date
,j.timespent
,j.description
,custom.CUSTOMVALUE 
,custom.CUSTOM_FIELD_NAME

from JIRA02.FCI4JIRA_COMMON_VIEW j

INNER JOIN JIRA02.FCI4JIRA_CUSTOMFIELD_VIEW custom ON j.project_key = custom.PKEY
)

pivot 
(
   MAX (CUSTOMVALUE)
   for (CUSTOM_FIELD_NAME) in ('Team','Fix/Resolution','Apps','Action Item','Tag','Saves:Tickets/week','Saves:Hours/week','Saves:Requests/week','Saves Justification')
)

我设法将问题与此代码行隔离开来

,j.description

如果我根本不包含此行,则代码运行正常。

我试图转换字段,但这引起了另一个问题。

,to_char(j.description)

ORA-22835:缓冲区太小,无法进行CLOB到CHAR或BLOB到RAW的转换(实际:7939,最大值:4000) 22835. 00000 - “缓冲区对于CLOB到CHAR或BLOB到RAW的转换太小(实际:%s,最大值:%s)”

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

dbms_lob.substr( clob_column, for_how_many_bytes, from_which_byte )

所以代替 ,j.description 尝试以下

,dbms_lob.substr( description, 100, 1 )

信用:https://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:367980988799