--管理员查看地址簿
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.raw_phone_number AS phone_number,
fax.raw_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
FROM 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 rfq
WHERE hps.status = 'A'
AND hps.party_id = 2540985 --and hps.created_by_module like 'POS%'
AND hzl.country = fvl.territory_code
AND email.owner_table_id(+) = hps.party_site_id
AND 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_id
AND 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_id
AND 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_id
AND pay.party_site_id(+) = hps.party_site_id
AND pur.party_site_id(+) = hps.party_site_id
AND rfq.party_site_id(+) = hps.party_site_id
AND pay.status(+) = 'A'
AND pur.status(+) = 'A'
AND rfq.status(+) = 'A'
AND nvl(pay.end_date(+),
SYSDATE) >= SYSDATE
AND nvl(pur.end_date(+),
SYSDATE) >= SYSDATE
AND nvl(rfq.end_date(+),
SYSDATE) >= SYSDATE
AND nvl(pay.begin_date(+),
SYSDATE) <= SYSDATE
AND nvl(pur.begin_date(+),
SYSDATE) <= SYSDATE
AND nvl(rfq.begin_date(+),
SYSDATE) <= SYSDATE
AND pay.site_use_type(+) = 'PAY'
AND pur.site_use_type(+) = 'PURCHASING'
AND rfq.site_use_type(+) = 'RFQ'
AND NOT EXISTS (SELECT 1
FROM pos_address_requests par,
pos_supplier_mappings psm
WHERE psm.party_id = hps.party_id
AND psm.mapping_id = par.mapping_id
AND party_site_id = hps.party_site_id
AND request_status = 'PENDING'
AND request_type IN ('UPDATE',
'DELETE'))
UNION ALL
SELECT 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.raw_phone_number AS phone_number,
fax.raw_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
FROM 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 rfq
WHERE hps.status = 'A'
AND hps.party_id = 2540985 --and hps.created_by_module like 'POS%'
AND hzl.country = fvl.territory_code
AND email.owner_table_id(+) = hps.party_site_id
AND 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_id
AND 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_id
AND 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_id
AND par.party_site_id = hps.party_site_id
AND psm.party_id = hps.party_id
AND psm.mapping_id = par.mapping_id
AND par.request_type IN ('UPDATE',
'DELETE')
AND par.request_status = 'PENDING'
AND pay.party_site_id(+) = hps.party_site_id
AND pur.party_site_id(+) = hps.party_site_id
AND rfq.party_site_id(+) = hps.party_site_id
AND pay.status(+) = 'A'
AND pur.status(+) = 'A'
AND rfq.status(+) = 'A'
AND nvl(pay.end_date(+),
SYSDATE) >= SYSDATE
AND nvl(pur.end_date(+),
SYSDATE) >= SYSDATE
AND nvl(rfq.end_date(+),
SYSDATE) >= SYSDATE
AND nvl(pay.begin_date(+),
SYSDATE) <= SYSDATE
AND nvl(pur.begin_date(+),
SYSDATE) <= SYSDATE
AND nvl(rfq.begin_date(+),
SYSDATE) <= SYSDATE
AND pay.site_use_type(+) = 'PAY'
AND pur.site_use_type(+) = 'PURCHASING'
AND rfq.site_use_type(+) = 'RFQ'
UNION ALL
SELECT 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
FROM pos_address_requests par,
pos_supplier_mappings psm,
fnd_territories_vl fvl
WHERE par.mapping_id = psm.mapping_id
AND par.country = fvl.territory_code
AND psm.party_id = 2540985
AND par.request_status = 'PENDING'
AND par.request_type = 'ADD'
--供应商查看地址簿信息
SELECT hps.party_site_id,
hps.party_site_name AS address_name --,'CURRENT' AS status
,
decode('CURRENT',
'NEW',
'新建',
'CURRENT',
'当前',
'CHANGED',
'更改待定',
'INACTIVE',
'无效',
NULL) 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.raw_phone_number AS phone_number,
fax.raw_phone_number AS fax_number,
'removeActiveImage' AS remove_image,
'editActiveImage' AS edit_image,
-1 AS address_request_id
FROM hz_party_sites hps,
hz_locations hzl,
fnd_territories_vl fvl,
hz_contact_points email,
hz_contact_points phone,
hz_contact_points fax
WHERE hps.status = 'A'
AND hps.party_id = 2540985 --and hps.created_by_module like 'POS%'
AND hzl.country = fvl.territory_code
AND email.owner_table_id(+) = hps.party_site_id
AND 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_id
AND 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_id
AND 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_id
AND NOT EXISTS (SELECT 1
FROM pos_address_requests
WHERE party_site_id = hps.party_site_id
AND request_status = 'PENDING')
UNION
SELECT par.party_site_id,
par.party_site_name AS address_name --,par.request_type AS status
,
decode(decode(par.request_type,
'ADD',
'NEW',
'UPDATE',
'CHANGED',
'UNKNOWN'),
'NEW',
'新建',
'CURRENT',
'当前',
'CHANGED',
'更改待定',
'INACTIVE',
'无效',
NULL) 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,
'removeActiveImage' AS remove_image,
'editActiveImage' AS edit_image,
par.address_request_id AS address_request_id
FROM pos_address_requests par,
pos_supplier_mappings psm,
fnd_territories_vl fvl
WHERE par.mapping_id = psm.mapping_id
AND par.country = fvl.territory_code
AND psm.party_id = 2540985
AND par.request_status = 'PENDING'
AND par.request_type IN ('ADD',
'UPDATE')

供应商和管理员查看供应商地址簿信息SQL的更多相关文章

  1. EBS标准的查看供应商地址

    --获取供应商PARTY_ID SELECT * FROM HZ_PARTIES HP WHERE HP.PARTY_NAME='XXXXXX' VO数据源:oracle.apps.pos.suppl ...

  2. 查看ip地址信息和配置临时ip

    查看ip地址信息:ifconfig –a 配置临时ip: ifconfig eth0 192.168.11.107

  3. 网络协议 16 - DNS 协议:网络世界的地址簿

    [前五篇]系列文章传送门: 网络协议 11 - Socket 编程(下):眼见为实耳听为虚 网络协议 12 - HTTP 协议:常用而不简单 网络协议 13 - HTTPS 协议:加密路上无尽头 网络 ...

  4. 如何查看LINUX 硬件配置信息

    如何查看LINUX 硬件配置信息 在网上找了N久,发现了一篇不错的文档,转载一下: 1.查看机器所有硬件信息: dmidecode |more dmesg |more 这2个命令出来的信息都非常多,所 ...

  5. Win8怎么查看IP地址

    win8查看自己IP地址方法一:查看本地网络法 1.首先从桌面右下角的“网络连接图标上”点击右键,然后选择打开网络和共享中心,如下图所示: 打开win8网络和共享中心 2.之后在打开的网络和共享中心窗 ...

  6. SAP供应商和客户的创建

    进来遇到一个创建供应商的需求,由于在系统中关于供应商和客户的创建比较特殊,且没有相关函数进行创建, 找到一个类和方法来创建,类名:VMD_EI_API  方法名:MAINTAIN_DIRECT_INP ...

  7. 查看Linux硬件配置信息

    在网上找了N久,发现了一篇不错的文档,转载一下: 1.查看机器所有硬件信息: dmidecode |more dmesg |more 这2个命令出来的信息都非常多,所以建议后面使用"|mor ...

  8. [python]小练习__创建你自己的命令行 地址簿 程序

    创建你自己的命令行 地址簿 程序. 在这个程序中,你可以添加.修改.删除和搜索你的联系人(朋友.家人和同事等等)以及它们的信息(诸如电子邮件地址和/或电话号码). 这些详细信息应该被保存下来以便以后提 ...

  9. iOS9中关于地址簿ABAddressBookXXX之类方法被废弃的解决

    大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 在iOS9的SDK中我们会发现原来地址簿权限查询,获取以及创建 ...

随机推荐

  1. iOS仿京东分类菜单实例实现

    在APP开发过程中此功能还是比较常见的模块,左边为菜单展示,右边为菜单下数据的展示,选择不同的菜单右边的数据源进行更新,此实例主要运用到UITableView,UICollectionView,OC谓 ...

  2. UIView与CALayer的区别

    1.UIView相比CALayer最大区别是UIView可以响应用户事件,而CALayer不可以.UIView侧重于对显示内容的管理,CALayer侧重于对内容的绘制. 2.UIView和CALaye ...

  3. UVa 109 - SCUD Busters(凸包计算)

    题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&pa ...

  4. 记录JVM垃圾回收算法

    垃圾回收算法可以分为三类,都基于标记-清除(复制)算法: Serial算法(单线程) 并行算法 并发算法 JVM会根据机器的硬件配置对每个内存代选择适合的回收算法,比如,如果机器多于1个核,会对年轻代 ...

  5. [LoadRunner]性能测试实践_Hessian协议脚本编写2

    协议选取和运行配置请参考:http://www.cnblogs.com/whylaughing/p/5430821.html 这次直接贴代码让大家参考: import lrapi.lr; import ...

  6. Remote Desktop Connection Manager (RDCMan) 介绍

    Remote Desktop Connection Manager介绍 Remote Desktop Connection Manager (RDCMan) 是微软Windows Live体验团队的主 ...

  7. Linux下恢复删除的文件

    转自:http://github.tiankonguse.com/blog/2015/09/13/linux-remove-recovery/ 下午, DBA找我说有些SQL执行了两个小时了,导致主从 ...

  8. html页面识别当前系统和语言

    项目中需要一个下载功能,根据系统跳转到不同的页面,如iphone跳转到IOS页面,android跳转到android页面. 下面为页面判断页面: <!DOCTYPE HTML> <h ...

  9. 使用Sqoop,最终导入到hive中的数据和原数据库中数据不一致解决办法

            Sqoop是一款开源的工具,主要用于在Hadoop(Hive)与传统的数据库(mysql.postgresql...)间进行数据的传递,可以将一个关系型数据库(例如 : MySQL , ...

  10. VirtualBox: Effective UID is not root (euid=1000 egid=100 uid=1000 gid=100)

    桌面上运行virtualbox出错: The virtual machine 'xp' has terminated unexpectedly during startup with exit cod ...