# 获取预算数据 sql = 'SELECT * FROM budget_2023 WHERE 项目名称=? AND ({})'.format(' OR '.join(['{}=?'.format(m) for m in mons_m])) p = (prj_m,) + tuple(mons_m) cursor = conn.cursor() cursor.execute(sql, p) budgets = cursor.fetchall() print('budget', budgets) TypeError: not all arguments converted during string formatting报错了,为什么?

时间: 2024-04-06 08:33:41 浏览: 69
这个错误通常是由于字符串格式化时,参数数量与占位符数量不匹配导致的。在你的代码中,可能是在格式化字符串时,占位符数量与给定的参数数量不一致,导致了这个错误。 检查一下代码中的占位符数量和参数数量是否匹配,尤其是在使用字符串格式化时。另外,也可以检查一下参数的数据类型是否正确,例如是否有传入字符串类型数据到需要传入数字类型数据的占位符中。
相关问题

sql = 'SELECT * FROM budget_2023 WHERE 项目名称=? AND ({})'.format(' OR '.join(['{}=?'.format(m) for m in mons_m])) cursor = conn.cursor() cursor.execute(sql, [prj_m] + mons_m) budgets = cursor.fetchall() print('budget', budgets)prj_m是一个字符,mons_m是个列表。TypeError: not all arguments converted during string formatting报错这个,为什么呢?

这个错误通常是因为在SQL语句中使用了占位符,但是在使用execute()方法时没有为所有占位符提供参数。在你的代码中,SQL语句中有一个占位符'?',但是在execute()方法中提供的参数列表中可能没有足够的参数来替换该占位符。 你可以使用print()语句来检查一下SQL语句和参数列表是否正确。另外,你也可以使用try...except块来捕获这种类型的错误,以便更好地调试代码。

将下面这条sql语句简化一下:SELECT * FROM ( SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "0" UNION ALL SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, sum( fpd.fpd_applied_amount ) AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "1" GROUP BY fpd_pay_num ) t1

SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax IN ("0","1") GROUP BY fpd_pay_num
阅读全文

相关推荐

将下面这条sql语句简短一些:SELECT * FROM ( SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "0" UNION ALL SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, sum( fpd.fpd_applied_amount ) AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "1" GROUP BY fpd_pay_num ) t1

将下面这条sql语句优化简短一些 :SELECT * FROM ( SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "0" UNION ALL SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, sum( fpd.fpd_applied_amount ) AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "1" GROUP BY fpd_pay_num ) t1

使其简短些 SELECT * FROM ( SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "0" UNION ALL SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, sum( fpd.fpd_applied_amount ) AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "1" GROUP BY fpd_pay_num ) t1

优化这个sql SELECT count( 1 ) FROM ( SELECT B.ID, B.PURCHASE_REQUEST_ID, B.MATERIAL_ID, B.MATERIAL_CODE, B.MATERIAL_NAME, B.STANDARD, B.MODEL_ID, B.BILL_ROW_ID, B.BILL_NO, BILL_NAME, B.MODEL_CODE, B.MODEL_NAME, B.PARENT_MODEL_ID, B.PARENT_MODEL_CODE, B.PARENT_MODEL_NAME, B.UNIT_CODE, B.UNIT_NAME, B.PURCHASE_TYPE_CODE, CAST( NVL( B.APPLY_NUM, 0 ) AS NUMBER ( 24, 10 ) ) AS APPLY_NUM, CAST( NVL( B.DEAL_NUM, 0 ) AS NUMBER ( 24, 10 ) ) AS DEAL_NUM, CAST( NVL( B.RETURN_NUM, 0 ) AS NUMBER ( 24, 10 ) ) AS RETURN_NUM, B.DEAL_USER_ID, B.DEAL_USER_NAME, CAST( NVL( B.PRICE, 0 ) AS NUMBER ( 24, 10 ) ) AS PRICE, CAST( NVL( B.AMOUNT, 0 ) AS NUMBER ( 24, 10 ) ) AMOUNT, B.IMPLEMENT_CODE, B.IMPLEMENT_NAME, B.IMPLEMENT_INVEST_AMOUNT, B.PURCHASE_MANAGER_ID, B.PURCHASE_MANAGER_NAME, B.PROVIDER_ID, B.PROVIDER_NAME, B.REMARK, B.DELIVER_AREA, B.DELIVER_ADDRESS, B.RECEIVE_PEOPLE, B.RECEIVE_PEOPLE_PHONE, B.ITEM_STATUS, B.COST_CENTER, B.COST_BUDGET_CODE, B.COST_IMPLEMENT_NAME, B.FRAME_CONT_ID, B.FRAME_CONT_CODE, B.FRAME_CONT_NAME, B.DETAIL_CONFIG, B.PURCHASE_CATEGORY_CODE, B.INVOICE_TITLE_CODE, B.INVOICE_SEND_ADDRRSS, B.MATERIAL_REQUEST_ITEM_ID, B.YEAR, B.DELETE_FLAG, B.PROVINCE_CODE, B.REASON, B.PARENT_ITEM_ID, B.FRAME_CONT_ITEM_ID, B.SUB_MATERIAL_REQUEST_ID, B.SUB_MATERIAL_REQUEST_CODE, B.MATERIAL_URL, B.RECOMMEND_PROVIDER_NAMES, C.PURCHASE_REQUEST_CODE, C.PURCHASE_REQUEST_NAME, C.APPLY_TYPE_CODE, C.CREATOR_NAME, C.APPLY_TELEPHONE, C.COMPANY_NAME, C.DEPT_NAME, B.CREATE_TIME, TO_CHAR( B.CREATE_TIME, 'YYYY-MM-DD' ) CREATE_TIME_STR, C.ARRIVE_TIME, C.IS_TO_END, C.MONEY_WAY_CODE, C.OWN, C.APPLY_CATEGORY_CODE, C.manu_Type, C.BILL_ID, MMD.MATERIAL_TYPE_CODE, B.BRANCH_COMPANY_DEAL_USER_ID, B.BRANCH_COMPANY_DEAL_USER_NAME, ( SELECT ORG_NAME FROM ORGANIZATIONS WHERE DELETE_FLAG = '0' AND ORG_CODE = ( SELECT PARENT_COMPANY_NO FROM ORGANIZATIONS WHERE ID = B.MATERIAL_DEPT_ID )) AS MATERIAL_COMPANY_NAME, B.ORIGINAL, B.PROVIDER_PRODUCT_MODEL, B.PROVIDER_PRODUCT_NAME, B.PRODUCT_DESC, B.Back_Flag, CASE WHEN MMD.material_type_code = 'WZ' THEN '1' WHEN MMD.material_type_code = 'FW' THEN '2' ELSE '3' END apply_category_code_item, NVL( C.IS_CARDSYSTEM_REQUEST, '0' ) IS_CARDSYSTEM_REQUEST, B.APPLY_GROUP_AUTHORITES, B.SCIENTIFIC_RESEARCH_ID, B.SCIENTIFIC_RESEARCH_CODE, B.SCIENTIFIC_RESEARCH_NAME, B.PREQUALFY_CODE, nvl( C.IS_QUICK, '0' ) AS IS_QUICK, C.PURCHASE_WAY_CODE, C.PURCHASE_TYPE_CODE PURCHASE_TYPE_CODE_P, C.ORIGINAL_TYPE, C.PURCHASE_REQUEST_BILLS_TYPE, B.IS_FRAME_CONT_MONAD FROM PURCHASE_REQUEST_ITEM B LEFT JOIN PURCHASE_REQUEST C ON B.PURCHASE_REQUEST_ID = C.ID LEFT JOIN MATERIAL_DATA MMD ON MMD.ID = B.MATERIAL_ID AND MMD.DELETE_FLAG = '0' WHERE B.delete_flag = '0' AND B.Item_Status IN ( 1 ) AND NOT EXISTS ( SELECT * FROM purchase_request_item_log pril WHERE B.id = pril.purchase_request_item_id AND pril.lock_status = '1' AND pril.delete_flag = '0' ) AND ( ( c.apply_type_code NOT IN ( '20', '41', '3' ) AND nvl( B.Apply_Num, 0 ) > nvl( B.Deal_Num, 0 )) OR c.apply_type_code IN ( '20', '41', '3' ) ) AND B.Deal_User_Id =: 1 AND C.MONEY_WAY_CODE =: 2 AND C.APPLY_TYPE_CODE =: 3 AND C.PAY_OUT_TYPE_CODE =: 4 AND C.APPLY_CATEGORY_CODE =: 5 AND NVL( C.IS_CARDSYSTEM_REQUEST, '0' ) = : 6 AND NOT EXISTS ( SELECT * FROM purchase_request_item p left join material_province mp ON p.material_id = mp.material_id WHERE p.delete_flag = 0 AND mp.delete_flag = 0 AND mp.material_status = 03 AND mp.org_code = p.province_code AND p.id = B.id ) ORDER BY C.ID, B.ID ASC)

改为pgsql select c.* from ( select a.* from ( SELECT t.PROJ_ID,t.PROJ_CODE,t.PROJ_NAME,t.CLIENT_CODE,t.CLIENT_NAME,t.SPEC_CODE,t.SPEC_NAME,t.BUS_UNIT_CODE,t.BUS_UNIT,t.PROJ_DEP_CODE,t.PROJ_DEP,t.PROJECT_MANAGER_CODE,t.PROJECT_MANAGER,t.PROJECT_DEP_MANAGER_CODE,t.PROJECT_DEP_MANAGER,t.IS_SUB_PROJ,t.SUB_PROJ_TYPE_CODE,t.SUB_PROJ_TYPE,t.PARENT_CODE,t.PROJ_GROSS,t.CLIENT_AREA_CODE,t.CLIENT_AREA,t.CLIENT_TYPE_FULL_PATH_CODE,t.CLIENT_TYPE_PULL_PATH,t.BUSINESS_TYPE_CODE,t.BUSINESS_TYPE,t.BUSINESS_LEVEL_CODE,t.BUSINESS_LEVEL,t.BUSINESS_AREA_CODE,t.BUSINESS_AREA_NAME,t.IS_CLOSE,t.IS_IN_COO,t.TAX_RATE,t.IS_AUTHORIZED,t.AUTHORIZED_AMOUNT,t.IS_VIRTUAL,t.INCOME_BUDGET,t.EXPENDITURE_BUDGET,t.P_VALUE,t.CREATE_TIME,t.P_BUD_VALUE,t.P1_BUD_VALUE,t.P2_BUD_VALUE,t.ORG_CODE,t.ORG_NAME,t.PROD_RES_TYPE,t.IS_TECH_COO,t.COO_UNIT_RATIO,t.PROJ_ACHIEVEMENTS_BUD,t.REIMBURSEMENT_COST_BUD,t.COO_COST_BUD,t.MATERIAL_COST_BUD,t.PERFORMANCE_PERCENT,t.SCHE_START_TIME,t.SCHE_END_TIME,t.PROJECT_ACCOUNT_CODE,t.CUSTOMER_TYPE_CODE,t.CUSTOMER_TYPE,t.IS_PURE_OUT_PROJ,t.PROJECT_CREATE_TIME,t.IS_RELATE,t.IS_QUOTA,t.MAIN_PROJECT_CODE,t.PROJ_STATUS,t.IS_LARGE_PROJECT,t.MARKET_DIS_COUNT_RATE,t.PROJECT_CAT,t.MGR_PER_FORMANCE_RATIO,t.P1_VALUE,t.S_VALUE,t.COOP_VALUE,t.H_VALUE,t.DEVICE_BUDGET_COST,t.SUR_FEE_DIS_COUNT_RATE,t.DES_FEE_DIS_COUNT_RATE, (select listagg(p.coo_unit_code, ',') within group(order by p.coo_unit_code) from ( select distinct coo_unit_code from t_spdi_proj where is_sub_proj = 'Y' and sub_proj_type_code = 'wbhz' and PROJ_STATUS != 'P_5' AND PROJ_STATUS != 'P_4' and parent_code = t.proj_code )p ) coo_unit_code, (select listagg(to_char(p.coo_unit), ',') within group(order by p.coo_unit) from ( select distinct coo_unit from t_spdi_proj where is_sub_proj = 'Y' and sub_proj_type_code = 'wbhz' and PROJ_STATUS != 'P_5' AND PROJ_STATUS != 'P_4' and parent_code = t.proj_code )p ) coo_unit from T_SPDI_PROJ t where -- and t.PARENT_CODE=#{parentCode:VARCHAR} t.IS_SUB_PROJ='Y' and t.SUB_PROJ_TYPE_CODE='zz' and t.PROJ_STATUS NOT IN ('E','H','W') order by t.proj_id )a )c

优化这条sql 解决bug select a.*,rownum num from ( SELECT t.PROJ_ID,t.PROJ_CODE,t.PROJ_NAME,t.CLIENT_CODE,t.CLIENT_NAME,t.SPEC_CODE,t.SPEC_NAME,t.BUS_UNIT_CODE,t.BUS_UNIT,t.PROJ_DEP_CODE,t.PROJ_DEP,t.PROJECT_MANAGER_CODE,t.PROJECT_MANAGER,t.PROJECT_DEP_MANAGER_CODE,t.PROJECT_DEP_MANAGER,t.IS_SUB_PROJ,t.SUB_PROJ_TYPE_CODE,t.SUB_PROJ_TYPE,t.PARENT_CODE,t.PROJ_GROSS,t.CLIENT_AREA_CODE,t.CLIENT_AREA,t.CLIENT_TYPE_FULL_PATH_CODE,t.CLIENT_TYPE_PULL_PATH,t.BUSINESS_TYPE_CODE,t.BUSINESS_TYPE,t.BUSINESS_LEVEL_CODE,t.BUSINESS_LEVEL,t.BUSINESS_AREA_CODE,t.BUSINESS_AREA_NAME,t.IS_CLOSE,t.IS_IN_COO,t.TAX_RATE,t.IS_AUTHORIZED,t.AUTHORIZED_AMOUNT,t.IS_VIRTUAL,t.INCOME_BUDGET,t.EXPENDITURE_BUDGET,t.P_VALUE,t.CREATE_TIME,t.P_BUD_VALUE,t.P1_BUD_VALUE,t.P2_BUD_VALUE,t.ORG_CODE,t.ORG_NAME,t.PROD_RES_TYPE,t.IS_TECH_COO,t.COO_UNIT_RATIO,t.PROJ_ACHIEVEMENTS_BUD,t.REIMBURSEMENT_COST_BUD,t.COO_COST_BUD,t.MATERIAL_COST_BUD,t.PERFORMANCE_PERCENT,t.SCHE_START_TIME,t.SCHE_END_TIME,t.PROJECT_ACCOUNT_CODE,t.CUSTOMER_TYPE_CODE,t.CUSTOMER_TYPE,t.IS_PURE_OUT_PROJ,t.PROJECT_CREATE_TIME,t.IS_RELATE,t.IS_QUOTA,t.MAIN_PROJECT_CODE,t.PROJ_STATUS,t.IS_LARGE_PROJECT,t.MARKET_DIS_COUNT_RATE,t.PROJECT_CAT,t.MGR_PER_FORMANCE_RATIO,t.P1_VALUE,t.S_VALUE,t.COOP_VALUE,t.H_VALUE,t.DEVICE_BUDGET_COST,t.SUR_FEE_DIS_COUNT_RATE,t.DES_FEE_DIS_COUNT_RATE, (select listagg(p.coo_unit_code, ',') within group(order by p.coo_unit_code) from ( select distinct coo_unit_code from t_spdi_proj where is_sub_proj = 'Y' and sub_proj_type_code = 'wbhz' and PROJ_STATUS != 'P_5' AND PROJ_STATUS != 'P_4' and parent_code = t.proj_code )p ) coo_unit_code, (select listagg(to_char(p.coo_unit), ',') within group(order by p.coo_unit) from ( select distinct coo_unit from t_spdi_proj where is_sub_proj = 'Y' and sub_proj_type_code = 'wbhz' and PROJ_STATUS != 'P_5' AND PROJ_STATUS != 'P_4' and parent_code = t.proj_code )p ) coo_unit from T_SPDI_PROJ t where t.PROJ_STATUS NOT IN ('E','H','W') order by t.proj_id )a

最新推荐

recommend-type

Flask和pyecharts实现动态数据可视化

在这个例子中,我们使用了好莱坞2006-2011的数据集,它包含了电影的相关信息,如电影名(Film)、主要制片厂(Major Studio)和预算(Budget)。我们的目标是统计并可视化这些年间的数据。 在Python环境中,我们...
recommend-type

英语四级高频单词、词组、短语.pdf

10. budget:预算,财务管理中的重要概念。 11. candidate:候选人,适用于选举或应聘职位。 12. transform:转变,变化,指事物的根本性变化。 13. transmit:传播,传输,如信息或疾病传播。 14. transplant:移植...
recommend-type

Font Awesome图标字体库提供可缩放矢量图标,它可以被定制大小、颜色、阴影以及任何可以用CSS的样式

Font Awesome图标字体库提供可缩放矢量图标,它可以被定制大小、颜色、阴影以及任何可以用CSS的样式
recommend-type

正整数数组验证库:确保值符合正整数规则

资源摘要信息:"validate.io-positive-integer-array是一个JavaScript库,用于验证一个值是否为正整数数组。该库可以通过npm包管理器进行安装,并且提供了在浏览器中使用的方案。" 该知识点主要涉及到以下几个方面: 1. JavaScript库的使用:validate.io-positive-integer-array是一个专门用于验证数据的JavaScript库,这是JavaScript编程中常见的应用场景。在JavaScript中,库是一个封装好的功能集合,可以很方便地在项目中使用。通过使用这些库,开发者可以节省大量的时间,不必从头开始编写相同的代码。 2. npm包管理器:npm是Node.js的包管理器,用于安装和管理项目依赖。validate.io-positive-integer-array可以通过npm命令"npm install validate.io-positive-integer-array"进行安装,非常方便快捷。这是现代JavaScript开发的重要工具,可以帮助开发者管理和维护项目中的依赖。 3. 浏览器端的使用:validate.io-positive-integer-array提供了在浏览器端使用的方案,这意味着开发者可以在前端项目中直接使用这个库。这使得在浏览器端进行数据验证变得更加方便。 4. 验证正整数数组:validate.io-positive-integer-array的主要功能是验证一个值是否为正整数数组。这是一个在数据处理中常见的需求,特别是在表单验证和数据清洗过程中。通过这个库,开发者可以轻松地进行这类验证,提高数据处理的效率和准确性。 5. 使用方法:validate.io-positive-integer-array提供了简单的使用方法。开发者只需要引入库,然后调用isValid函数并传入需要验证的值即可。返回的结果是一个布尔值,表示输入的值是否为正整数数组。这种简单的API设计使得库的使用变得非常容易上手。 6. 特殊情况处理:validate.io-positive-integer-array还考虑了特殊情况的处理,例如空数组。对于空数组,库会返回false,这帮助开发者避免在数据处理过程中出现错误。 总结来说,validate.io-positive-integer-array是一个功能实用、使用方便的JavaScript库,可以大大简化在JavaScript项目中进行正整数数组验证的工作。通过学习和使用这个库,开发者可以更加高效和准确地处理数据验证问题。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

【损失函数与随机梯度下降】:探索学习率对损失函数的影响,实现高效模型训练

![【损失函数与随机梯度下降】:探索学习率对损失函数的影响,实现高效模型训练](https://img-blog.csdnimg.cn/20210619170251934.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzNjc4MDA1,size_16,color_FFFFFF,t_70) # 1. 损失函数与随机梯度下降基础 在机器学习中,损失函数和随机梯度下降(SGD)是核心概念,它们共同决定着模型的训练过程和效果。本
recommend-type

在ADS软件中,如何选择并优化低噪声放大器的直流工作点以实现最佳性能?

在使用ADS软件进行低噪声放大器设计时,选择和优化直流工作点是至关重要的步骤,它直接关系到放大器的稳定性和性能指标。为了帮助你更有效地进行这一过程,推荐参考《ADS软件设计低噪声放大器:直流工作点选择与仿真技巧》,这将为你提供实用的设计技巧和优化方法。 参考资源链接:[ADS软件设计低噪声放大器:直流工作点选择与仿真技巧](https://wenku.csdn.net/doc/9867xzg0gw?spm=1055.2569.3001.10343) 直流工作点的选择应基于晶体管的直流特性,如I-V曲线,确保工作点处于晶体管的最佳线性区域内。在ADS中,你首先需要建立一个包含晶体管和偏置网络
recommend-type

系统移植工具集:镜像、工具链及其他必备软件包

资源摘要信息:"系统移植文件包通常包含了操作系统的核心映像、编译和开发所需的工具链以及其他辅助工具,这些组件共同作用,使得开发者能够在新的硬件平台上部署和运行操作系统。" 系统移植文件包是软件开发和嵌入式系统设计中的一个重要概念。在进行系统移植时,开发者需要将操作系统从一个硬件平台转移到另一个硬件平台。这个过程不仅需要操作系统的系统镜像,还需要一系列工具来辅助整个移植过程。下面将详细说明标题和描述中提到的知识点。 **系统镜像** 系统镜像是操作系统的核心部分,它包含了操作系统启动、运行所需的所有必要文件和配置。在系统移植的语境中,系统镜像通常是指操作系统安装在特定硬件平台上的完整副本。例如,Linux系统镜像通常包含了内核(kernel)、系统库、应用程序、配置文件等。当进行系统移植时,开发者需要获取到适合目标硬件平台的系统镜像。 **工具链** 工具链是系统移植中的关键部分,它包括了一系列用于编译、链接和构建代码的工具。通常,工具链包括编译器(如GCC)、链接器、库文件和调试器等。在移植过程中,开发者使用工具链将源代码编译成适合新硬件平台的机器代码。例如,如果原平台使用ARM架构,而目标平台使用x86架构,则需要重新编译源代码,生成可以在x86平台上运行的二进制文件。 **其他工具** 除了系统镜像和工具链,系统移植文件包还可能包括其他辅助工具。这些工具可能包括: - 启动加载程序(Bootloader):负责初始化硬件设备,加载操作系统。 - 驱动程序:使得操作系统能够识别和管理硬件资源,如硬盘、显卡、网络适配器等。 - 配置工具:用于配置操作系统在新硬件上的运行参数。 - 系统测试工具:用于检测和验证移植后的操作系统是否能够正常运行。 **文件包** 文件包通常是指所有这些组件打包在一起的集合。这些文件可能以压缩包的形式存在,方便下载、存储和传输。文件包的名称列表中可能包含如下内容: - 操作系统特定版本的镜像文件。 - 工具链相关的可执行程序、库文件和配置文件。 - 启动加载程序的二进制代码。 - 驱动程序包。 - 配置和部署脚本。 - 文档说明,包括移植指南、版本说明和API文档等。 在进行系统移植时,开发者首先需要下载对应的文件包,解压后按照文档中的指导进行操作。在整个过程中,开发者需要具备一定的硬件知识和软件开发经验,以确保操作系统能够在新的硬件上正确安装和运行。 总结来说,系统移植文件包是将操作系统和相关工具打包在一起,以便于开发者能够在新硬件平台上进行系统部署。了解和掌握这些组件的使用方法和作用是进行系统移植工作的重要基础。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

【损失函数与批量梯度下降】:分析批量大小对损失函数影响,优化模型学习路径

![损失函数(Loss Function)](https://img-blog.csdnimg.cn/20190921134848621.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80Mzc3MjUzMw==,size_16,color_FFFFFF,t_70) # 1. 损失函数与批量梯度下降基础 在机器学习和深度学习领域,损失函数和批量梯度下降是核心概念,它们是模型训练过程中的基石。理解它们的基础概念对于构建