Oracle EBS客户化程序中格式化金额
在Oracle EBS系统中,随处可见金额的显示格式,通常情况下都具有千分位符,同时有一定位数的精度,让我们先来看看一些现成的例子
上面这些列子中的金额都显示了千分位符,同时具备以2位小数,难道这个格式就是程序写死的?答案显然是否定的。
1 2 3 4 5 6 7 8 9 10 11 |
( 'headers.amount_total', FORMAT_MASK, fnd_currency.get_format_mask( :headers.currency_code, get_item_property('headers.amount_total',MAX_LENGTH))) -- headers.amount_total 需要格式化金额对应的Item -- :headers.currency_code 币种对应的字段 -- 如果数据中没有币种可以通过下面代码取得本位币 SELECT sob.currency_code FROM gl_sets_of_books sob WHERE sob.set_of_books_id = fnd_profile.value('GL_SET_OF_BKS_ID'); |
2,在数据库的PLSQL中格式化金额
如果编写的数据库PLSQL程序中需要格式化输出金额,Oracle提供了服务端的fnd_currency.get_format_mask 方法,可以使用如下的代码来格式化:
1 2 3 4 5 |
; l_amount number := 100000; l_currency_code varchar2(30) := 'USD'; l_amount_char := to_char(amount, fnd_currency.get_format_mask(l_currency_code,30)) |
3,在Report报表中格式化金额
对于在Report报表中格式化金额,Oracle专门提供了用户出口函数来解决这个问题,相对步骤更加复杂一些,就留作其它文章再描述吧。
http://oracleseeker.com/2009/08/20/format_amount_mask_using_dynamic_currency_in_oracle_ebs/