plsql ebs 工作中的简单笔记

工作流中给系统界面发送消息:

  PROCEDURE wf_notify(p_sender       IN VARCHAR2 DEFAULT 'SYSADMIN',p_receiver     IN VARCHAR2,p_subject      IN VARCHAR2,p_content_text IN VARCHAR2);PROCEDURE wf_notify(p_sender       IN VARCHAR2 DEFAULT 'SYSADMIN',---发送者p_receiver     IN VARCHAR2,--接收人p_subject      IN VARCHAR2,p_content_text IN VARCHAR2) ISPRAGMA AUTONOMOUS_TRANSACTION;v_notification_id wf_notifications.notification_id%TYPE;BEGINv_notification_id := wf_notification.send(role     => p_receiver,msg_type => 'CS_MSGS',msg_name => 'EXPANDED_FYI_MSG',due_date => SYSDATE,priority => 1);wf_notification.setattrtext(nid    => v_notification_id,aname  => '#FROM_ROLE',avalue => p_sender);wf_notification.setattrtext(nid    => v_notification_id,aname  => 'OBJECT_TYPE',avalue => p_subject);wf_notification.setattrtext(nid    => v_notification_id,aname  => 'SENDER',avalue => p_sender);wf_notification.setattrtext(nid    => v_notification_id,aname  => 'MESSAGE_TEXT',avalue => p_content_text);wf_notification.denormalize_notification(nid => v_notification_id);dbms_transaction.commit;EXCEPTIONWHEN OTHERS THENdbms_transaction.rollback;END wf_notify;beginfnd_global.apps_initialize(user_id      => 234969,resp_id      => 51737,resp_appl_id => 50201);
end;begindbms_output.put_line(fnd_global.user_name);cux_ws_bip_pub_pkg.wf_notify('SYSADMIN',fnd_global.user_name,'请求异的信息','CESHI.................');
end;

将org_id和code链接到一起
select hou.short_code from hr_operating_units hou where hou.organization_id=2084;

清理卡死的程序:

select va.sid,va.OBJECT from v$access va where object like '%CUX_WS_BIP_TBGYS_PKG%';
SELECT * FROM dba_ddl_locks t WHERE t.name = 'CUX_WS_BIP_TBGYS_PKG';
SELECT * FROM V$DB_OBJECT_CACHE WHERE name='CUX_WS_BIP_TBGYS_PKG' AND LOCKS!='0';
select * FROM dba_ddl_locks where name =upper('CUX_WS_BIP_TBGYS_PKG');
select t.sid, t.serial# from v$session t where t.sid  in (4534,8595);
alter system kill session '4534,43139'; 
alter system kill session '8595,23529'; 

查询供应商地址蒲信息:
在这里插入图片描述

SELECT *FROM (select hps.party_site_id,hps.party_site_name as address_name,'CURRENT' as status,hzl.address1 as loc_address1,hzl.address2 as loc_address2,hzl.address3 as loc_address3,hzl.city as loc_city,hzl.county as loc_county,hzl.state as loc_state,hzl.province as loc_province,hzl.postal_code as loc_postal_code,hzl.country as loc_country,fvl.territory_short_name as country_name,hzl.address4 as loc_address4,email.email_address,phone.phone_area_code || ' ' || phone.phone_number AS phone_number,fax.phone_area_code || ' ' || fax.phone_number AS fax_number,decode(POS_UTIL_PKG.IS_ADDR_CCR(1.0, '', hps.party_site_id),'T','removeInActiveImage','removeActiveImage') as remove_image,'mngSites' as edit_image,-1 as address_request_id,decode(pay.site_use_type, 'PAY', 'Y', 'N') as pay_flag,decode(pur.site_use_type, 'PURCHASING', 'Y', 'N') as pur_flag,decode(rfq.site_use_type, 'RFQ', 'Y', 'N') as rfq_flag,'TCA' as address_type,hzl.address1 || ' , ' || hzl.address2 || ' , ' ||hzl.address3 || ' , ' || hzl.address4 || ' , ' || hzl.city ||' , ' || hzl.county || ' , ' || hzl.STATE || ' , ' ||hzl.province || ' , ' || hzl.postal_code || ' , ' ||fvl.territory_short_name as address_detail_int,'SourceSystemEnabled' as source_system_switcher,POS_SUPP_CONTACT_PKG.get_address_purpose_string(hps.party_site_id,'APPROVED') AS purposefrom hz_party_sites     hps,hz_locations       hzl,fnd_territories_vl fvl,hz_contact_points  email,hz_contact_points  phone,hz_contact_points  fax,hz_party_site_uses pay,hz_party_site_uses pur,hz_party_site_uses rfqwhere hps.status = 'A'and hps.party_id = 7345--:1 --and hps.created_by_module like 'POS%' and hzl.COUNTRY = fvl.TERRITORY_CODEand email.owner_table_id(+) = hps.party_site_idand email.owner_table_name(+) = 'HZ_PARTY_SITES'and email.status(+) = 'A'and email.contact_point_type(+) = 'EMAIL'and email.primary_flag(+) = 'Y'and phone.owner_table_id(+) = hps.party_site_idand phone.owner_table_name(+) = 'HZ_PARTY_SITES'and phone.status(+) = 'A'and phone.contact_point_type(+) = 'PHONE'and phone.phone_line_type(+) = 'GEN'and phone.primary_flag(+) = 'Y'and fax.owner_table_id(+) = hps.party_site_idand fax.owner_table_name(+) = 'HZ_PARTY_SITES'and fax.status(+) = 'A'and fax.contact_point_type(+) = 'PHONE'and fax.phone_line_type(+) = 'FAX'and hps.location_id = hzl.location_idand pay.party_site_id(+) = hps.party_site_idand pur.party_site_id(+) = hps.party_site_idand rfq.party_site_id(+) = hps.party_site_idand pay.status(+) = 'A'and pur.status(+) = 'A'and rfq.status(+) = 'A'and nvl(pay.end_date(+), sysdate) >= sysdateand nvl(pur.end_date(+), sysdate) >= sysdateand nvl(rfq.end_date(+), sysdate) >= sysdateand nvl(pay.begin_date(+), sysdate) <= sysdateand nvl(pur.begin_date(+), sysdate) <= sysdateand nvl(rfq.begin_date(+), sysdate) <= sysdateand pay.site_use_type(+) = 'PAY'and pur.site_use_type(+) = 'PURCHASING'and rfq.site_use_type(+) = 'RFQ'and not exists(select 1from pos_address_requests par, pos_supplier_mappings psmwhere psm.party_id = hps.party_idand psm.mapping_id = par.MAPPING_IDand party_site_id = hps.party_site_idand request_status = 'PENDING'and request_type in ('UPDATE', 'DELETE'))UNION ALLselect hps.party_site_id,hps.party_site_name as address_name,decode(par.request_type,'UPDATE','CHANGED','DELETE','CHANGED') as status,hzl.address1 as loc_address1,hzl.address2 as loc_address2,hzl.address3 as loc_address3,hzl.city as loc_city,hzl.county as loc_county,hzl.state as loc_state,hzl.province as loc_province,hzl.postal_code as loc_postal_code,hzl.country as loc_country,fvl.territory_short_name as country_name,hzl.address4 as loc_address4,email.email_address,phone.phone_area_code || ' ' || phone.phone_number AS phone_number,fax.phone_area_code || ' ' || fax.phone_number AS fax_number,'removeInActiveImage' as remove_image,decode(par.request_type,'UPDATE','mngSites','DELETE','mngSitesDisabled') as edit_image,par.address_request_id as address_request_id,decode(pay.site_use_type, 'PAY', 'Y', 'N') as pay_flag,decode(pur.site_use_type, 'PURCHASING', 'Y', 'N') as pur_flag,decode(rfq.site_use_type, 'RFQ', 'Y', 'N') as rfq_flag,'TCA' as address_type,hzl.address1 || ' , ' || hzl.address2 || ' , ' ||hzl.address3 || ' , ' || hzl.address4 || ' , ' || hzl.city ||' , ' || hzl.county || ' , ' || hzl.STATE || ' , ' ||hzl.province || ' , ' || hzl.postal_code || ' , ' ||fvl.territory_short_name as address_detail_int,decode(par.request_type,'UPDATE','SourceSystemEnabled','DELETE','SourceSystemDisabled') as source_system_switcher,POS_SUPP_CONTACT_PKG.get_address_purpose_string(hps.party_site_id,'APPROVED') AS purposefrom hz_party_sites        hps,hz_locations          hzl,fnd_territories_vl    fvl,hz_contact_points     email,hz_contact_points     phone,hz_contact_points     fax,pos_address_requests  par,pos_supplier_mappings psm,hz_party_site_uses    pay,hz_party_site_uses    pur,hz_party_site_uses    rfqwhere hps.status = 'A'and hps.party_id = 7345--:2 --and hps.created_by_module like 'POS%' and hzl.COUNTRY = fvl.TERRITORY_CODEand email.owner_table_id(+) = hps.party_site_idand email.owner_table_name(+) = 'HZ_PARTY_SITES'and email.status(+) = 'A'and email.contact_point_type(+) = 'EMAIL'and email.primary_flag(+) = 'Y'and phone.owner_table_id(+) = hps.party_site_idand phone.owner_table_name(+) = 'HZ_PARTY_SITES'and phone.status(+) = 'A'and phone.contact_point_type(+) = 'PHONE'and phone.phone_line_type(+) = 'GEN'and phone.primary_flag(+) = 'Y'and fax.owner_table_id(+) = hps.party_site_idand fax.owner_table_name(+) = 'HZ_PARTY_SITES'and fax.status(+) = 'A'and fax.contact_point_type(+) = 'PHONE'and fax.phone_line_type(+) = 'FAX'and hps.location_id = hzl.location_idand par.party_site_id = hps.party_site_idand psm.party_id = hps.party_idand psm.mapping_id = par.mapping_idand par.request_type in ('UPDATE', 'DELETE')AND PAR.request_status = 'PENDING'and pay.party_site_id(+) = hps.party_site_idand pur.party_site_id(+) = hps.party_site_idand rfq.party_site_id(+) = hps.party_site_idand pay.status(+) = 'A'and pur.status(+) = 'A'and rfq.status(+) = 'A'and nvl(pay.end_date(+), sysdate) >= sysdateand nvl(pur.end_date(+), sysdate) >= sysdateand nvl(rfq.end_date(+), sysdate) >= sysdateand nvl(pay.begin_date(+), sysdate) <= sysdateand nvl(pur.begin_date(+), sysdate) <= sysdateand nvl(rfq.begin_date(+), sysdate) <= sysdateand pay.site_use_type(+) = 'PAY'and pur.site_use_type(+) = 'PURCHASING'and rfq.site_use_type(+) = 'RFQ'UNION ALLselect par.party_site_id,par.party_site_name as address_name,decode(par.request_type,'ADD','NEW','UPDATE','CHANGED','UNKNOWN') as status,par.address_line1 as loc_address1,par.address_line2 as loc_address2,par.address_line3 as loc_address3,par.city as loc_city,par.county as loc_county,par.state as loc_state,par.province as loc_province,par.postal_code as loc_postal_code,par.country as loc_country,fvl.territory_short_name as country_name,par.address_line4 as loc_address4,par.email_address,par.phone_area_code || ' ' || par.phone_number || ' ' ||par.PHONE_EXTENSION as phone_number,par.fax_area_code || ' ' || par.FAX_NUMBER as fax_number,'removeInActiveImage' as remove_image,decode(par.request_type,'UPDATE','mngSites','mngSitesDisabled') as edit_image,par.address_request_id as address_request_id,decode(par.pay_flag, 'Y', 'Y', 'N') as pay_flag,decode(par.PUR_FLAG, 'Y', 'Y', 'N') as pur_flag,decode(par.rfq_flag, 'Y', 'Y', 'N') as rfq_flag,'POS' as address_type,par.address_line1 || ' , ' || par.address_line2 || ' , ' ||par.address_line3 || ' , ' || par.address_line4 || ' , ' ||par.city || ' , ' || par.county || ' , ' || par.STATE ||' , ' || par.province || ' , ' || par.postal_code || ' , ' ||fvl.territory_short_name as address_detail_int,'SourceSystemDisabled' as source_system_switcher,POS_SUPP_CONTACT_PKG.get_address_purpose_string(par.address_request_id,'REQUESTED') purposefrom pos_address_requests  par,pos_supplier_mappings psm,fnd_territories_vl    fvlwhere par.mapping_id = psm.mapping_idand par.COUNTRY = fvl.TERRITORY_CODEand psm.party_id = /*:3*/7345) QRSLTWHERE (rownum < 302)ORDER BY ADDRESS_NAME ASC

查询配置文件
在这里插入图片描述

SELECT FND_PROFILE.value('CUX_WS_20BIP_APPKEY'),FND_PROFILE.value('CUX_WS_20BIP_APPSECRET') FROM SYS.DUAL;

供应商基础信息:

SELECT --ass.vendor_id vendor_id,--ass.party_id party_id,pv.vendor_id,pv.party_id,--REPLACE(REPLACE(ass.segment1, chr(13), ''), chr(10), '') vendor_code, --供应商编码--REPLACE(REPLACE(ass.vendor_name, chr(13), ''), chr(10), '') vendor_name, --供应商名称--REPLACE(REPLACE(ass.vendor_name, chr(13), ''), chr(10), '') vendor_short_name, --供应商短名称REPLACE(REPLACE(pv.SEGMENT1, chr(13), ''), chr(10), '') AS vendor_code,REPLACE(REPLACE(pv.vendor_name, chr(13), ''), chr(10), '') VENDOR_NAME,REPLACE(REPLACE(pv.VENDOR_NAME_ALT, chr(13), ''), chr(10), '') AS vendor_short_name,decode(upper(pv.vendor_type_lookup_code),'EMPLOYEE',papf.national_identifier,decode(pv.organization_type_lookup_code,'INDIVIDUAL',pv.individual_1099,'FOREIGN INDIVIDUAL',pv.individual_1099,pv.num_1099)) NUM_1099 ---纳税人标识FROM --ap_suppliers ass, po_vendors       pv,per_all_people_f papfWHERE /*(*/--ass.vendor_id = g_Param_Rec.vendor_id /*OR--AND ass.vendor_id = pv.vendor_idpv.last_update_date BETWEEN g_param_rec.last_update_date_fm ANDg_param_rec.last_update_date_toAND pv.employee_id = papf.person_id(+)AND Nvl(papf.EFFECTIVE_END_DATE, SYSDATE) >= SYSDATE;

供应商银行信息:

 SELECT REPLACE(REPLACE(accts.bank_account_name, chr(13), ''),chr(10),'') bank_account_name, --账户名REPLACE(REPLACE(fc.name, chr(13), ''), chr(10), '') AS currency_name, --银行币种REPLACE(REPLACE(bank.party_name, chr(13), ''), chr(10), '') AS bank_name, --银行名称REPLACE(REPLACE(accts.masked_bank_account_num, chr(13), ''),chr(10),'') AS bank_account_number, ---银行账号REPLACE(REPLACE(branch.bank_branch_name, chr(13), ''),chr(10),'') bank_branch_name, --银行分行名称REPLACE(REPLACE(bankProfile.bank_or_branch_number, chr(13), ''),chr(10),'') AS bank_number, ---银行编码ExtBanksEO.BANK_PARTY_ID,countries.TERRITORY_SHORT_NAME ------------FROM iby_pmt_instr_uses_all   uses,iby_external_payees_all  payee,iby_ext_bank_accounts    accts,fnd_currencies_vl        fc,HZ_PARTIES               bank,HZ_ORGANIZATION_PROFILES bankProfile,CE_BANK_BRANCHES_V       branch,IBY_EXT_BANKS_V          ExtBanksEO,fnd_territories_vl       countriesWHERE uses.instrument_type = 'BANKACCOUNT'AND payee.ext_payee_id = uses.ext_pmt_party_idAND payee.payee_party_id = l_payee_party_idAND payee.payment_function = 'PAYABLES_DISB'/*and payee.party_site_id is nulland payee.org_id is nulland payee.supplier_site_id is null*/AND uses.instrument_id = accts.ext_bank_account_idAND fc.currency_code(+) = accts.currency_codeAND SYSDATE BETWEEN NVL(accts.start_date, SYSDATE) ANDNVL(accts.end_date, SYSDATE)AND accts.bank_id = bank.party_id(+)AND accts.bank_id = bankProfile.party_id(+)AND accts.branch_id = branch.branch_party_id(+)AND SYSDATE BETWEEN TRUNC(bankProfile.effective_start_date(+)) ANDNVL(TRUNC(bankProfile.effective_end_date(+)), SYSDATE + 1)AND accts.BANK_ID = ExtBanksEO.BANK_PARTY_IDAND ExtBanksEO.HOME_COUNTRY = countries.territory_code(+);

供应商地点信息:

 SELECT REPLACE(REPLACE(pvsa.VENDOR_SITE_CODE, chr(13), ''),chr(10),'') VENDOR_SITE_CODE, -------------详细地址REPLACE(REPLACE(hrou.name, chr(13), ''), chr(10), '') AS org_name, --------------公司段编码Decode(pv.VENDOR_TYPE_LOOKUP_CODE,'EMPLOYEE',Decode(pvsa.VENDOR_SITE_CODE,'HOME',fnd_message.get_string('POS', 'POS_HT_SP_HOME'),'OFFICE',fnd_message.get_string('POS', 'POS_HT_SP_OFFICE'),'PROVISIONAL',fnd_message.get_string('POS','POS_HT_SP_PROVISIONAL'),pvsa.VENDOR_SITE_CODE),pvsa.VENDOR_SITE_CODE) siteName ------------地点名称FROM ap_supplier_sites_all    pvsa, ---hr_operating_units       hrou, ---ap_supplier_sites_all    pay_site,po_location_associations poas,ap_system_parameters_all ap_param,hr_locations             hrl,ap_suppliers             pv ----WHERE pvsa.vendor_id = l_vendor_idAND pv.vendor_id = pvsa.vendor_idAND poas.vendor_id(+) = pvsa.vendor_idAND poas.vendor_site_id(+) = pvsa.vendor_site_idAND hrl.location_id(+) = pvsa.ship_to_location_idAND hrou.organization_id = pvsa.org_idAND pvsa.default_pay_site_id = pay_site.vendor_site_id(+)--and mo_global.check_access(pvsa.org_id) = 'Y'AND pvsa.org_id = ap_param.org_id;

同步ERP资产转移分配信息:
在这里插入图片描述

      select fdh.book_type_code, --资产帐簿编码--15AD.asset_id, --固定资产编码--1flo.segment1 Locations, --地点--gcc.segment1, --公司--gcc.segment2, --部门--gcc.segment3, --科目--gcc.segment4, --子目--gcc.segment5, --产品--gcc.segment6, --项目--gcc.segment7, --往来--gcc.segment8, --管理维度--gcc.segment9, --备用--ppf.last_name, --使用人名称ppf.person_id, --使用人编码(SELECT sum(fdha.UNITS_ASSIGNED)FROM FA_DISTRIBUTION_HISTORY fdhaWHERE ('' IS NULL AND fdha.DATE_INEFFECTIVE IS NULL ANDfdha.BOOK_TYPE_CODE = fdh.book_type_code ANDfdha.ASSET_ID = fdh.asset_id AND 'TRANSFER' != 'TRANSFER IN')OR ('' IS NOT NULL AND(fdha.TRANSACTION_HEADER_ID_OUT = '' AND'TRANSFER' IN('TRANSFER', 'TRANSFER OUT', 'UNIT ADJUSTMENT')) OR(fdha.TRANSACTION_HEADER_ID_IN = '' AND'TRANSFER' IN('TRANSFER IN', 'TRANSFER', 'UNIT ADJUSTMENT') AND(fdha.CODE_COMBINATION_ID, fdha.LOCATION_ID,NVL(fdha.ASSIGNED_TO, -99)) NOT IN(SELECT DH.CODE_COMBINATION_ID,DH.LOCATION_ID,NVL(DH.ASSIGNED_TO, -99)FROM FA_DISTRIBUTION_HISTORY DHWHERE DH.ASSET_ID = fdh.asset_idAND DH.BOOK_TYPE_CODE = fdh.book_type_codeAND DH.TRANSACTION_HEADER_ID_OUT = ''AND 'TRANSFER' IN('TRANSFER', 'TRANSFER OUT', 'UNIT ADJUSTMENT'))))and  ROWNUM = 1) IN_OUT, --卡片总数量fdh.UNITS_ASSIGNED, --数量fdh.DISTRIBUTION_ID, --行idgcc.chart_of_accounts_idfrom gl_code_combinations    gcc,fa_locations            flo,FA_ADDITIONS_B          AD,fa_distribution_history fdh,per_people_f            ppfwhere (fdh.book_type_code = g_Param_Rec.p_book_type_code ORg_Param_Rec.p_book_type_code is null) ---and (fdh.asset_id = g_Param_Rec.p_asset_id ORg_Param_Rec.p_asset_id is null) ---and (fdh.LAST_UPDATE_DATE >=to_date(g_Param_Rec.p_lu_date_begin, 'yyyy-mm-dd') ORg_Param_Rec.p_lu_date_begin is null) ---and (fdh.LAST_UPDATE_DATE <to_date(g_Param_Rec.p_lu_date_end, 'yyyy-mm-dd') ORg_Param_Rec.p_lu_date_end is null) ---and fdh.asset_id = AD.asset_id(+)AND fdh.location_id = flo.location_id(+)AND fdh.code_combination_id = gcc.code_combination_id(+)AND fdh.assigned_to = ppf.person_id(+)and fdh.DATE_INEFFECTIVE is null;

资产卡片-基本信息:

SELECT DISTINCT AD.asset_id,AD.ASSET_NUMBER, --固定资产编码--03AD.LAST_UPDATE_DATE, --最后更改时间fdh.book_type_code, --资产帐簿编码--01fbc.BOOK_TYPE_NAME, --资产帐簿名称--02ADT.DESCRIPTION, --固定资产名称--04fcv.segment4 asset_category, -- 资产类别最末级段--05fck.concatenated_segments category_code, --资产类别--06fcv.description category_desc, --资产类别说明--07fb.prorate_convention_code, --折旧惯例----21fb.deprn_method_code, --折旧方法----20fak.SEGMENT1, --旧资产编号-----15fak.SEGMENT2, --来源方式(说明)---16AD.CURRENT_UNITS, --数量--------------08AD.TAG_NUMBER, --标签号--------------09AD.SERIAL_NUMBER, --序列号----------------11AD.MODEL_NUMBER, --型号------------10AD.in_use_flag, --L17 使用状态AD.context, --L18 说明性弹性域(SELECT 'Y'FROM FA_RETIREMENTS frWHERE fr.book_type_code = fb.book_type_codeAND fr.asset_id = fb.asset_idAND fr.status = 'PROCESSED'AND ROWNUM = 1) retire_exists_flag, --L22 报废状态(R) (SELECT SUM(NVL(fr.cost_retired, 0))FROM FA_RETIREMENTS frWHERE fr.book_type_code = fb.book_type_codeAND fr.asset_id = fb.asset_idAND fr.status = 'PROCESSED') sum_retired_cost, --L51  已报废总额fb.original_cost, --L10 原始成本fb.date_placed_in_service, --L25 启用日期fb.depreciate_flag, --L26 折旧状态fb.life_in_months, --L29 资产寿命(月) (SELECT 'Y'FROM FA_TRANSACTION_HEADERS fth1WHERE fth1.book_type_code = fb.book_type_codeAND fth1.asset_id = fb.asset_idAND (fth1.transaction_subtype = 'AMORTIZED' ORfth1.transaction_key = 'UA')AND fth1.transaction_header_id <=fb.transaction_header_id_inAND ROWNUM < 2) check_amort_flag --L37 是否摊销FROM FA_ADDITIONS_B          AD, --FA_ADDITIONS_TL         ADT, --fa_distribution_history fdh, --fa_book_controls        fbc, --fa_categories_vl        fcv, --fa_categories_b_kfv     fck, --fa_additions_b          fab,fa_books                fb, --FA_DEPRN_PERIODS        fdp,FA_ASSET_KEYWORDS       fak --WHERE --AD.asset_id = 10006269(fdh.book_type_code = g_Param_Rec.p_book_type_code ORg_Param_Rec.p_book_type_code is null) ---and (fdh.asset_id = g_Param_Rec.p_asset_id ORg_Param_Rec.p_asset_id is null) ---and (AD.LAST_UPDATE_DATE >=to_date(g_Param_Rec.p_lu_date_begin, 'yyyy-mm-dd') ORg_Param_Rec.p_lu_date_begin is null) ---and (AD.LAST_UPDATE_DATE <to_date(g_Param_Rec.p_lu_date_end, 'yyyy-mm-dd') ORg_Param_Rec.p_lu_date_end is null) ---AND fb.book_type_code = fdp.book_type_code(+)and fak.CODE_COMBINATION_ID = AD.ASSET_KEY_CCIDAND fb.asset_id = fab.asset_idand fab.asset_id = fdh.asset_idAND fab.asset_category_id = fcv.category_idAND fcv.category_id = fck.category_idand fbc.BOOK_TYPE_CODE = fdh.book_type_codeand AD.asset_id = fdh.asset_idAND AD.ASSET_ID = ADT.ASSET_IDAND ADT.LANGUAGE = userenv('LANG');IF rec_apply.in_use_flag = 'YES' THENlv_in_use_flag := '使用中';ELSElv_in_use_flag := '不在使用中';END IF;beginSELECT LISTAGG(application_column_name, '||''' || '|' || '''||') WITHIN GROUP(ORDER BY column_seq_num) concatenated_struc,LISTAGG(end_user_column_name, '|') WITHIN GROUP(ORDER BY column_seq_num) concatenated_valueinto l_concatenated_struc, l_concatenated_valueFROM FND_DESCR_FLEX_COL_USAGE_VLWHERE 1 = 1AND enabled_flag = 'Y'AND descriptive_flexfield_name LIKE 'FA_ADDITIONS'AND descriptive_flex_context_code IN(rec_apply.context, 'Global Data Elements')ORDER BY column_seq_num;IF l_concatenated_struc IS NULL THENlv_dff_val := '';ELSEl_concatenated_struc := 'SELECT ' || l_concatenated_struc ||CHR(10) || 'FROM   FA_ADDITIONS_B' ||CHR(10) || 'WHERE  asset_id = ' ||rec_apply.asset_id;EXECUTE IMMEDIATE l_concatenated_strucINTO lv_dff_val;END IF;EXCEPTIONWHEN NO_DATA_FOUND THENl_concatenated_value := '';l_concatenated_struc := '';lv_dff_val           := '';END;ln_original_cost        := NVL(rec_apply.original_cost, 0);ln_cur_sum_retired_cost := NVL(rec_apply.sum_retired_cost, 0);ln_current_cost         := ln_original_cost -ln_cur_sum_retired_cost;IF rec_apply.retire_exists_flag = 'Y' THENIF ln_current_cost <= 0 THENlv_retire_exists_desc := '全部报废';ELSElv_retire_exists_desc := '部分报废';END IF;ELSElv_retire_exists_desc := '未报废';END IF;IF rec_apply.depreciate_flag = 'YES' THENlv_depreciate_flag_desc := '需提折旧';ELSElv_depreciate_flag_desc := '不提折旧';END IF;l_life_years  := rec_apply.life_in_months / 12;l_life_months := rec_apply.life_in_months - l_life_years * 12;SELECT PRORATE_DATE --折旧日期--22into l_PRORATE_DATEFROM FA_BOOKS_VWHERE date_ineffective is nulland (BOOK_TYPE_CODE LIKE rec_apply.book_type_code)and (ASSET_ID = rec_apply.asset_id);select fdp.calendar_period_open_date,fdp.calendar_period_close_dateinto l_calendar_period_open_date, l_calendar_period_close_datefrom FA_DEPRN_PERIODS fdpwhere fdp.book_type_code = rec_apply.book_type_codeand fdp.calendar_period_close_date =(select max(fdp.calendar_period_close_date)from FA_DEPRN_PERIODS fdpwhere fdp.book_type_code = rec_apply.book_type_codegroup by fdp.book_type_code);IF rec_apply.check_amort_flag = 'Y' THENlv_check_amort_flag_desc := '是';SELECT GREATEST(l_calendar_period_open_date,LEAST(SYSDATE, l_calendar_period_close_date))INTO ld_amortization_start_dateFROM FA_DEPRN_PERIODSWHERE book_type_code = rec_apply.book_type_codeAND period_close_date IS NULL;ELSElv_check_amort_flag_desc := '否';END IF;

资产账簿:

      SELECT hou.organization_id,hou.name,fbc.BOOK_TYPE_NAME,fbc.BOOK_TYPE_code,gcc.segment1 coa_com, --公司--,fbc.last_update_date,gcc.chart_of_accounts_idFROM hr_operating_units      hou,FA_BOOK_CONTROLS        fbc,gl_code_combinations    gcc,fa_distribution_history fdhWHERE hou.set_of_books_id = fbc.set_of_books_idand fbc.BOOK_TYPE_CODE = fdh.book_type_codeAND fdh.code_combination_id = gcc.code_combination_idand (fbc.LAST_UPDATE_DATE > to_date(g_Param_Rec.p_lu_date_begin, 'yyyy-mm-dd') ORg_Param_Rec.p_lu_date_begin is null) and (fbc.LAST_UPDATE_DATE < to_date(g_Param_Rec.p_lu_date_end, 'yyyy-mm-dd') ORg_Param_Rec.p_lu_date_end is null) ;

查询值集:
在这里插入图片描述

      SELECT ffvs.flex_value_set_name, --名称ffvs.flex_value_set_id, --idffvs.description               description1, --名称说明ffvv.FLEX_VALUE, --值ffvv.FLEX_VALUE_MEANING, --转换的值ffvv.DESCRIPTION               DESCRIPTION2, --说明ffvv.ENABLED_FLAG, ----是否启用ffvv.START_DATE_ACTIVE, ---有效日期自ffvv.END_DATE_ACTIVE, ---有效日期至SUBSTR(ffvv.COMPILED_VALUE_ATTRIBUTES,5,1) COMPILED_VALUE_ATTRIBUTESFROM FND_FLEX_VALUES_VL ffvv, fnd_flex_value_sets ffvsWHERE (('' IS NULL) OR(structured_hierarchy_level IN(SELECT hierarchy_idFROM fnd_flex_hierarchies_vl hWHERE h.flex_value_set_id = ffvv.FLEX_VALUE_SET_IDAND h.hierarchy_name like '')))and ffvv.FLEX_VALUE_SET_ID = ffvs.FLEX_VALUE_SET_IDand ffvs.flex_value_set_name = 'CG_COA_ACCOUNT' and (ffvv.last_update_date >to_date(g_Param_Rec.P_LAST_UPDATE, 'yyyy-mm-dd') ORg_Param_Rec.P_LAST_UPDATE is null) ---order by flex_value;

银行总行数据获取:

      Select replace(replace(BankParty.PARTY_ID,chr(13),''),chr(10),'') bank_id,replace(replace(replace(BankParty.PARTY_NAME,chr(13),''),chr(10),''),chr(9),'') bank_name,replace(replace(FndTerritory.territory_short_name,chr(13),''),chr(10),'')  territory_short_name, ------BankParty.LAST_UPDATE_DATEFrom HZ_PARTIES               BankParty,HZ_ORGANIZATION_PROFILES BankOrgProfile,HZ_CODE_ASSIGNMENTS      BankCA,FND_TERRITORIES_VL       FndTerritoryWhere BankParty.PARTY_TYPE = 'ORGANIZATION'And BankParty.status = 'A'And BankParty.PARTY_ID = BankOrgProfile.PARTY_IDAnd SYSDATE between TRUNC(BankOrgProfile.effective_start_date) andNVL(TRUNC(BankOrgProfile.effective_end_date), SYSDATE + 1)And BankCA.CLASS_CATEGORY = 'BANK_INSTITUTION_TYPE'And BankCA.CLASS_CODE in ('BANK', 'CLEARINGHOUSE')And BankCA.OWNER_TABLE_NAME = 'HZ_PARTIES'And BankCA.OWNER_TABLE_ID = BankParty.PARTY_IDAnd NVL(BankCA.STATUS, 'A') = 'A'And BankOrgProfile.HOME_COUNTRY = FndTerritory.territory_codeand BankParty.LAST_UPDATE_DATE >to_date(g_Param_Rec.p_lu_date_begin, 'yyyy-mm-dd')and BankParty.LAST_UPDATE_DATE <to_date(g_Param_Rec.p_lu_date_end, 'yyyy-mm-dd')

银行分行数据:

SELECT BranchParty.party_id,replace(replace(BankParty.PARTY_NAME,chr(13),''),chr(10),'')  AS 银行名, ---------------总行名称replace(replace(replace(replace(BranchParty.party_name,chr(13),''),chr(10),''),chr(34),'') ,chr(9),'')        AS bank_branch_name, -----------------分行名称BranchCA.end_date_active     AS 无效日期,BranchParty.LAST_UPDATE_DATE,replace(replace(BranchParty.party_id,chr(13),''),chr(10),'')           AS bank_branch_id, ---分行编号replace(replace(BankParty.PARTY_ID,chr(13),''),chr(10),'')             AS bank_id ------------------总行编号FROM hz_parties               BranchParty,hz_organization_profiles BranchOrgProfile,hz_code_assignments      BranchTypeCA,hz_code_assignments      RfcCA,hz_contact_points        BranchCP,HZ_CONTACT_POINTS        BranchCPEdi,hz_code_assignments      BranchCA,HZ_PARTIES               BankParty,HZ_ORGANIZATION_PROFILES BankOrgProfile,HZ_CODE_ASSIGNMENTS      BankCA,HZ_RELATIONSHIPS         BRRelWHERE BranchParty.PARTY_ID = BranchOrgProfile.PARTY_IDAnd SYSDATE between TRUNC(BranchOrgProfile.effective_start_date) andNVL(TRUNC(BranchOrgProfile.effective_end_date), SYSDATE + 1)AND BranchCA.owner_table_name = 'HZ_PARTIES'AND BranchCA.owner_table_id = BranchParty.party_idAND BranchCA.class_category = 'BANK_INSTITUTION_TYPE'And BranchCA.CLASS_CODE in ('BANK_BRANCH', 'CLEARINGHOUSE_BRANCH')And NVL(BranchCA.STATUS, 'A') = 'A'AND BranchTypeCA.owner_table_name(+) = 'HZ_PARTIES'AND BranchTypeCA.owner_table_id(+) = BranchParty.party_idAND BranchTypeCA.class_category(+) = 'BANK_BRANCH_TYPE'AND NVL(BranchTypeCA.primary_flag(+), 'Y') = 'Y' -- 8870466AND RfcCA.owner_table_name(+) = 'HZ_PARTIES'AND RfcCA.owner_table_id(+) = BranchParty.party_idAND RfcCA.class_category(+) = 'RFC_IDENTIFIER'And NVL(RfcCA.STATUS(+), 'A') = 'A'And SYSDATE between TRUNC(RfcCA.start_date_active(+)) andNVL(TRUNC(RfcCA.end_date_active(+)), SYSDATE + 1)AND BranchCP.owner_table_name(+) = 'HZ_PARTIES'AND BranchCP.owner_table_id(+) = BranchParty.party_idAND BranchCP.contact_point_type(+) = 'EFT'AND BranchCP.status(+) = 'A'And BranchCPEdi.OWNER_TABLE_NAME(+) = 'HZ_PARTIES'And BranchCPEdi.OWNER_TABLE_ID(+) = BranchParty.PARTY_IDAnd BranchCPEdi.CONTACT_POINT_TYPE(+) = 'EDI'And BranchCPEdi.STATUS(+) = 'A'AND BankParty.PARTY_ID = BankOrgProfile.PARTY_IDAnd SYSDATE between TRUNC(BankOrgProfile.effective_start_date) andNVL(TRUNC(BankOrgProfile.effective_end_date), SYSDATE + 1)AND BankParty.PARTY_TYPE = 'ORGANIZATION'And BankParty.status = 'A'And BankCA.CLASS_CATEGORY = 'BANK_INSTITUTION_TYPE'And BankCA.CLASS_CODE in ('BANK', 'CLEARINGHOUSE')And BankCA.OWNER_TABLE_NAME = 'HZ_PARTIES'And BankCA.OWNER_TABLE_ID = BankParty.PARTY_IDAnd NVL(BankCA.STATUS, 'A') = 'A'And BRRel.OBJECT_ID = BankParty.PARTY_IDAnd BranchParty.PARTY_ID = BRRel.SUBJECT_IDAnd BRRel.RELATIONSHIP_TYPE = 'BANK_AND_BRANCH'And BRRel.RELATIONSHIP_CODE = 'BRANCH_OF'And BRRel.STATUS = 'A'And BRRel.SUBJECT_TABLE_NAME = 'HZ_PARTIES'And BRRel.SUBJECT_TYPE = 'ORGANIZATION'And BRRel.OBJECT_TABLE_NAME = 'HZ_PARTIES'And BRRel.OBJECT_TYPE = 'ORGANIZATION'AND BranchParty.LAST_UPDATE_DATE >to_date(g_Param_Rec.p_lu_date_begin, 'yyyy-mm-dd')AND BranchParty.LAST_UPDATE_DATE <to_date(g_Param_Rec.p_lu_date_end, 'yyyy-mm-dd')

银行账户数据:

Select replace(replace(BranchParty.PARTY_NAME, chr(13), ''),chr(10),'') bank_branch_name, --分行名称BranchParty.PARTY_ID bank_branch_id, ---分行idBankAccountEO.BANK_ACCOUNT_ID,replace(replace(replace(replace(BankAccountEO.BANK_ACCOUNT_NAME,chr(13),''),chr(10),''),chr(32),''),chr(9),'') bank_account_name, ----------帐户名CE_BANK_AND_ACCOUNT_UTIL.GET_MASKED_BANK_ACCT_NUM(BANK_ACCOUNT_ID) bank_account_num, ---------账户账号BankAccountEO.CURRENCY_CODE currency_code, ----币种 (select ffv1.descriptionfrom fnd_flex_values_vl ffv1where ffv1.FLEX_VALUE(+) = BankAccountEO.ATTRIBUTE1and ffv1.enabled_flag = 'Y'and ffv1.LAST_UPDATE_DATE =(select max(ffv2.LAST_UPDATE_DATE)from fnd_flex_values_vl ffv2where ffv2.flex_value = ffv1.flex_value)) ATTRIBUTE1 ----账户性质From HZ_PARTIES               BankParty,HZ_PARTIES               BranchParty,HZ_ORGANIZATION_PROFILES BankOrgProfile,HZ_ORGANIZATION_PROFILES BranchOrgProfile,HZ_RELATIONSHIPS         BRRel,HZ_CODE_ASSIGNMENTS      BankCA,HZ_CODE_ASSIGNMENTS      BranchCA,CE_LOOKUPS               CL,FND_TERRITORIES_VL       FT,CE_BANK_ACCOUNTS         BankAccountEO,CE_LOOKUPS               CLAccountType,xle_entity_profiles      xleWhere BankParty.PARTY_TYPE = 'ORGANIZATION'And BankParty.status = 'A'And BankParty.PARTY_ID = BankOrgProfile.PARTY_IDAnd SYSDATE between TRUNC(BankOrgProfile.effective_start_date) andNVL(TRUNC(BankOrgProfile.effective_end_date), SYSDATE + 1)And BankCA.CLASS_CATEGORY = 'BANK_INSTITUTION_TYPE'And BankCA.CLASS_CODE = 'BANK'And BankCA.OWNER_TABLE_NAME = 'HZ_PARTIES'And BankCA.OWNER_TABLE_ID = BankParty.PARTY_IDAnd NVL(BankCA.STATUS, 'A') = 'A'And BranchParty.PARTY_TYPE = 'ORGANIZATION'And BranchParty.status = 'A'And BranchOrgProfile.PARTY_ID = BranchParty.PARTY_IDAnd SYSDATE betweenTRUNC(BranchOrgProfile.effective_start_date(+)) andNVL(TRUNC(BranchOrgProfile.effective_end_date(+)), SYSDATE + 1)And BranchCA.CLASS_CATEGORY = 'BANK_INSTITUTION_TYPE'And BranchCA.CLASS_CODE = 'BANK_BRANCH'And BranchCA.OWNER_TABLE_NAME = 'HZ_PARTIES'And BranchCA.OWNER_TABLE_ID = BranchParty.PARTY_IDAnd NVL(BranchCA.STATUS, 'A') = 'A'And BRRel.OBJECT_ID = BankParty.PARTY_IDAnd BranchParty.PARTY_ID = BRRel.SUBJECT_IDAnd BRRel.RELATIONSHIP_TYPE = 'BANK_AND_BRANCH'And BRRel.RELATIONSHIP_CODE = 'BRANCH_OF'And BRRel.STATUS = 'A'And BRRel.SUBJECT_TABLE_NAME = 'HZ_PARTIES'And BRRel.SUBJECT_TYPE = 'ORGANIZATION'And BRRel.OBJECT_TABLE_NAME = 'HZ_PARTIES'And BRRel.OBJECT_TYPE = 'ORGANIZATION'and cl.lookup_type = 'ACCOUNT_CLASSIFICATION'and cl.lookup_code = 'INTERNAL'and BankOrgProfile.home_country = FT.territory_codeAnd BankAccountEO.BANK_BRANCH_ID = BranchParty.party_idAnd CLAccountType.lookup_type(+) = 'BANK_ACCOUNT_TYPE'and CLAccountType.lookup_code(+) = BankAccountEO.BANK_ACCOUNT_TYPEand xle.LEGAL_ENTITY_ID = BankAccountEO.ACCOUNT_OWNER_ORG_IDand (BankAccountEO.LAST_UPDATE_DATE >to_date(g_Param_Rec.p_lu_date_begin, 'yyyy-mm-dd') ORg_Param_Rec.p_lu_date_begin is null) ---and (BankAccountEO.LAST_UPDATE_DATE <to_date(g_Param_Rec.p_lu_date_end, 'yyyy-mm-dd') ORg_Param_Rec.p_lu_date_end is null) ---

一篇好的文章:https://blog.csdn.net/cai_xingyun/article/details/38016687

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/86890.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Apache SeaTunnel 2.3.3 版本发布,CDC 支持 Schema Evolution!

时隔两个月&#xff0c; Apache SeaTunnel 终于迎来大版本更新。此次发布的 2.3.3 版本在功能和性能上均有较大优化改进&#xff0c;其中大家期待已久的 CDC Schema evolution&#xff08;DDL 变更同步&#xff09;、主键 Split 拆分、JDBC Sink 自动建表功能、SeaTunnel Zeta …

重新认识零售,重新认识美团

曾有人发起这样一个投票&#xff1a;如果手机里只留3个App&#xff0c;你会留下谁&#xff1f;类似的问题还有&#xff0c;如果要教家里老人用手机&#xff0c;优先哪几个App&#xff1f; 微信毫无疑问地排在第一名。很多人没想到是&#xff0c;答案里排名第二的是美团&#x…

QT基础使用:组件和代码关联(信号和槽)

自动关联 ui文件在设计环境下&#xff0c;能看到的组件可以使用鼠标右键选择“转到槽”就是开始组件和动作关联。 在自动关联这个过程中软件自动动作的部分 需要对前面头文件进行保存&#xff0c;才能使得声明的函数能够使用。为了方便&#xff0c;自动关联时先对所有文件…

【Vue】vue2预览显示quill富文本内容,vue-quill-editor回显页面,v-html回显富文本内容

文章目录 前言一、下载二、使用步骤1.引入样式2.html代码 总结 前言 提示&#xff1a;这里可以添加本文要记录的大概内容&#xff1a; vue后台框架&#xff0c;若依系统里有一个富文本编辑器&#xff0c;效果如下 在package.json里面查看&#xff0c;发现插件名叫quill 插件的…

Mysql报错 mysqladmin flush-hosts

出现这个的原因是错误连接达到数据库设置的最大值。 此时需要释放重置连接最大值。 进入mysql使用命令 flush-hosts;环境说明&#xff1a; 内网测试服务器192.168.18.251 为WEB服务器&#xff0c;安装了mysql; 内网音视频转码服务器192.168.18.253安装了转码工具&#xff0…

Visual Studio 2022的MFC框架——theApp全局对象

我是荔园微风&#xff0c;作为一名在IT界整整25年的老兵&#xff0c;今天我们来重新审视一下Visual Studio 2022下开发工具的MFC框架知识。 MFC中的WinMain函数是如何与MFC程序中的各个类组织在一起的呢&#xff1f;MFC程序中的类是如何与WinMain函数关联起来的呢&#xff1f…

CSDN每日一练 |『影分身』『小鱼的航程(改进版)』『排查网络故障』2023-08-25

CSDN每日一练 |『影分身』『小鱼的航程&#xff08;改进版&#xff09;』『排查网络故障』2023-08-25 一、题目名称&#xff1a;影分身二、题目名称&#xff1a;小鱼的航程(改进版)三、题目名称&#xff1a;排查网络故障 一、题目名称&#xff1a;影分身 时间限制&#xff1a;1…

【golang】panic函数、recover函数以及defer语句

从panic被引发到程序终止运行的大致过程是什么&#xff1f; 大致过程&#xff1a; 某个函数中的某行代码有意无意地引发了一个panic。这时&#xff0c;初始的panic详情会被建立起来&#xff0c;并且该程序的控制权会立即从从行代码转移至调用其所属函数的那行代码上&#xff…

屏蔽百度右侧热搜和首页新闻

先看效果 这样就没有垃圾新闻影响我们的注意力了 设置其实很简单&#xff0c;首先需要安装一下 Adblock Plus&#xff0c;安装的方式很多&#xff0c;这里我使用一个网站直接添加即可&#xff1a; Download Adblock Plus 3.18.1 CRX File for Chrome - Crx4Chrome 然后就能在…

【数据结构】详解环形队列

文章目录 &#x1f30f;引言&#x1f340;[循环队列](https://leetcode.cn/problems/design-circular-queue/description/)&#x1f431;‍&#x1f464;题目描述&#x1f431;‍&#x1f453;示例&#xff1a;&#x1f431;‍&#x1f409;提示&#x1f431;‍&#x1f3cd;思…

前端显示gif流文件,gif图验证码

1、前端界面展示效果图&#xff1a;gif动态图片 2、接口获取流文件 3、接口配置 export function getBlob(params){return request({url: /session/generatorCode,method: get,params,catchAll:true,responseType:"arraybuffer"}) }4、数据处理 getBlob({key:thi…

Linux用户与组管理(02)(七)

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 目录 前言 一、批量创建 二、修改属性 三、密码设置 四、删除 总结 前言 今天学习的是上次剩余的用户组的内容&#xff0c;也是相对于刚学习Linux系统比较重要的部分&#x…