标签:
(1)获取帐套本位币
-- 取得当前帐套本位币
SELECT gsob.currency_code
FROM gl_sets_of_books gsob,
hr_operating_units hou
WHERE gsob.set_of_books_id = hou.set_of_books_id
AND hou.organization_id = fnd_profile.value(‘ORG_ID‘);
(2)币种间转换
-- 取得指定币种(例如:HKD)当天转向当前帐套本位币(例如:CNY)的汇率
SELECT gdr.conversion_rate
FROM gl_daily_rates_v gdr
WHERE gdr.from_currency = ‘HKD‘
AND gdr.to_currency IN (SELECT gsob.currency_code
FROM gl_sets_of_books gsob,
hr_operating_units hou
WHERE gsob.set_of_books_id = hou.set_of_books_id
AND hou.organization_id = fnd_profile.value(‘ORG_ID‘))
AND gdr.conversion_type = ‘Corporate‘
AND gdr.conversion_date = trunc(SYSDATE);
(3)调用EBS的API来转换
SELECT gl_currency_api.get_rate(x_from_currency => ‘HKD‘,
x_to_currency => ‘CNY‘,
x_conversion_date => trunc(SYSDATE),
x_conversion_type => ‘Corporate‘)
如果要转换的两种币种是一样的,那么在查询的时候,要做一个判断,然后取值为1。
标签:
原文地址:http://www.cnblogs.com/gary-bao/p/4861141.html