BLOB-объекты не допускаются в «отдельном предложении», и когда я удаляю разделенные, ошибка показывает, что BLOB-объекты недопустимы в предложении union. Моя цель - извлечь примечания по настройке из столбца not_note_text.
select distinct-- select the docketed entries
schedasc.as_lead_caseid as as_lead_caseid, not_caseid, not_seq, not_note_text
case when not_docnum = 0 then 'C'
else 'S' end note_type, not_docnum
from u_schedule sched, u_asccase schedasc, u_person schedpr, cal2004:notes, u_dktentry, cal2004:permissions
where sched.sd_dtset >= '$startdate' and sched.sd_dtset <= '$enddate'
and sched.sd_caseid = schedasc.as_caseid
and schedasc.as_type != 'rel'
and schedasc.as_group is NULL
--and sched.sd_type not like '%zz%'
and sched.sd_dtsatis is null
and sched.sd_date_term is null
and sched.sd_judge_prid = pr_prid
and schedpr.pr_ao_code = '$judgeaocode'
--Start Notes Mix
and not_caseid = schedasc.as_caseid
and (not_docnum = de_document_num or not_docnum = 0)
and de_caseid = not_caseid
and de_seqno = sd_deseqno
and per_user = not_person
and per_aocode = 'AALL'
$notetype_line
and not_aocode = '$judgeaocode'
union
select distinct-- select the docketed entries
not_caseid as as_lead_caseid, not_caseid, not_seq, not_note_text,
case when not_docnum = 0 then 'C'
else 'S' end note_type, not_docnum
from u_schedule sched, u_person schedpr, cal2004:notes, u_dktentry, cal2004:permissions, u_case
where sched.sd_dtset >= '$startdate' and sched.sd_dtset <= '$enddate'
--and sched.sd_caseid = schedasc.as_lead_caseid
--and schedasc.as_type != 'rel'
--and schedasc.as_group is NULL
--and sched.sd_type not like '%zz%'
and sched.sd_dtsatis is null
and sched.sd_date_term is null
and sched.sd_judge_prid = pr_prid
and schedpr.pr_ao_code = '$judgeaocode'
and cs_caseid = not_caseid
and cs_type = 'cv'
--Start Notes Mix
and not_caseid = sched.sd_caseid
and (not_docnum = de_document_num or not_docnum = 0)
and de_caseid = not_caseid
and de_seqno = sd_deseqno
and per_user = not_person
and per_aocode = 'AALL'
$notetype_line
and not_aocode = '$judgeaocode'
order by as_lead_caseid, not_caseid, note_type desc, not_seq
" 2>/dev/null |&
while IFS="|" read -p as_lead_caseid not_caseid not_seq not_note note_type not_docnum
do