问题描述
所以我从cx_oracle下面收到此错误。
Traceback (most recent call last):
File "C:\ariel_deltas\excel.py",line 493,in generate_excel_file
df = get_datframe_from_sql_with_binds(sql_lu_status,cursor_analytics,{"v0": current_snapshot_id})
File "C:\ariel_deltas\dataframes.py",line 52,in get_datframe_from_sql_with_binds
rs,col_names = get_data_with_binds(sql,cursor,bind_vars)
File "C:\ariel_deltas\data.py",line 129,in get_data_with_binds
rs = cursor.fetchall()
cx_Oracle.DatabaseError: ORA-01489: result of string concatenation is too long
Error occured creating Excel file
Traceback (most recent call last):
File "C:\ariel_deltas\excel.py",in get_data_with_binds
rs = cursor.fetchall()
cx_Oracle.DatabaseError: ORA-01489: result of string concatenation is too long
我的查询如下:
SELECT
a.snapshot_date,a.change_type,a.lu_number,a.lu_title,a.date_type,a.date_before,a.date_after,a.value_before,a.value_after,a.lu_status_remarks as status_remarks,a.lu_category,a.scrn_no,a.lu_description,a.lu_remarks,listagg(b.preferred_Trade_name,';;;') within group (order by b.preferred_Trade_name) as products,listagg(c.country_display_label,';;;') within group (order by c.country_display_label) as countries,listagg(d.registration_uid,';;;') within group (order by d.registration_uid) as registrations,listagg(g.application_stage,';;;') within group (order by g.application_stage) as application_stage,listagg(h.application_type,';;;') within group (order by h.application_type) as application_type,listagg(e.internal_ref_no,';;;') within group (order by e.internal_ref_no) as study_code,listagg(f.registration_name_details,';;;') within group (order by f.registration_name_details) as registration_name_details
FROM
python_event_stream a,V_PYTHON_LU_disTINCT_PRODUCTS b,V_PYTHON_LU_disTINCT_COUNTRIES c,V_PYTHON_LU_disTINCT_REG d,V_PYTHON_LU_disTINCT_STUDY_CODE e,V_PYTHON_LU_disTINCT_REG_NAME_DET f,V_PYTHON_LU_disTINCT_REG_NAME_APP_STAGE g,V_PYTHON_LU_disTINCT_REG_NAME_APP_TYPE h
where
a.snapshot_id_new = b.snapshot_id_new and a.variation_request_id = b.variation_request_id
and
a.snapshot_id_new = c.snapshot_id_new and a.variation_request_id = c.variation_request_id
and
a.snapshot_id_new = d.snapshot_id_new and a.variation_request_id = d.variation_request_id
and
a.snapshot_id_new = e.snapshot_id_new and a.variation_request_id = e.variation_request_id
and
a.snapshot_id_new = f.snapshot_id_new and a.variation_request_id = f.variation_request_id
and
a.snapshot_id_new = g.snapshot_id_new and a.variation_request_id = g.variation_request_id
and
a.snapshot_id_new = h.snapshot_id_new and a.variation_request_id = h.variation_request_id
and a.snapshot_id_new = :v0 AND a.TABLE_NAME = 'FACT_LOCAL_UPDATE_STATUS'
AND 1 = 1 AND 1 = 1 AND 1 = 1 AND 1 = 1
GROUP BY
a.snapshot_date,a.lu_status_remarks,a.lu_remarks
order by lu_number
查询在Oracle中运行良好。当我将其导出到Excel时,listagg输出的最长结果是1021个字符。所以我不确定是什么问题。
我无法转换为Clob,因为openpyxl不知道如何处理它。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)