I have a slight problem with the following query and, in particular, the "substr" and "length" functions. Some help solving it would be great.
Constructive criticism on the query in general is also welcome, of course.
SQL> @test-query-oracle.sql
1 select published.curriculum_id,
2 published.name as curriculum_name,
3 substr(published.description,1,11) as curriculum_desc,
4 case when length(published.description) > 11
5 then 1 else 0 end as curr_desc_trunc_p,
6 case when ucm.curriculum_id is null
7 then 0 else 1 end as undesired_p,
8 cee.element_id,
9 cee.name as element_name,
10 substr(cee.description,1,11) as element_desc,
11 case when length(cee.description) > 11
12 then 1 else 0 end as elem_desc_trunc_p,
13 cee.url
14 from (select cc.*
15 from cu_curriculums cc,
16 workflow_cases cas,
17 workflow_case_fsm cfsm
18 where cc.package_id = 434
19 and cas.object_id = cc.curriculum_id
20 and cfsm.case_id = cas.case_id
21 and cfsm.current_state = 9
22 ) published,
23 cu_user_curriculum_map ucm,
24 cu_elements_enabled cee
25 where published.package_id = ucm.package_id(+)
26 and published.curriculum_id = ucm.curriculum_id(+)
27 and 306 = ucm.user_id(+)
28 and published.curriculum_id = cee.curriculum_id(+)
29 order by published.sort_key,
30* cee.sort_key
SQL> /
case when length(cee.description) > 11
*
ERROR at line 11:
ORA-00932: inconsistent datatypes
PS. when I comment out the "case" and "substr" rows in the select list the query returns the selection I expect it to.
Request notifications