index

Package gb_currency_rate

Functional support for Currency Rates and conversion (Common Business interface CURRENCY_RATE in a future release).


Program units
f_api_version   Returns the API version number.
f_converted_amount   Returns converted amount.
f_exists   Checks to see if a record exists.
f_query_all   Selects all records for the entity.
f_query_by_rowid   Selects one record using ROWID.
f_query_one   Selects one record using key.
p_edit_calc   Edits the currency code and effective date, and returns the converted amount.

Types
currency_rate_rec   Entity record type
currency_rate_ref   Entity cursor variable type
currency_rate_tab   Entity table type

Constants
M_ENTITY_NAME   Business Entity name


M_ENTITY_NAME

M_ENTITY_NAME    CONSTANT VARCHAR2(13) := 'CURRENCY_RATE';

Business Entity name


currency_rate_rec

TYPE currency_rate_rec IS RECORD (
   r_curr_code               gurcurr.gurcurr_curr_code%TYPE,
   r_conv_rate               gurcurr.gurcurr_conv_rate%TYPE,
   r_rate_eff_date           gurcurr.gurcurr_rate_eff_date%TYPE,
   r_rate_nchg_date          gurcurr.gurcurr_rate_nchg_date%TYPE,
   r_user_id                 gurcurr.gurcurr_user_id%TYPE,
   r_internal_record_id      VARCHAR2(18));

Entity record type


currency_rate_ref

TYPE currency_rate_ref IS REF CURSOR RETURN currency_rate_rec;

Entity cursor variable type


currency_rate_tab

TYPE currency_rate_tab IS TABLE OF currency_rate_rec INDEX BY BINARY_INTEGER;

Entity table type


f_api_version

FUNCTION f_api_version RETURN PLS_INTEGER

Returns the API version number.

Returns
Version of the API signature. Changes only when the signature changes.


f_converted_amount

FUNCTION f_converted_amount(p_curr_code     gurcurr.gurcurr_curr_code%TYPE,
                            p_rate_eff_date gurcurr.gurcurr_rate_eff_date%TYPE,
                            p_num_decimal   INTEGER,
                            p_amount        NUMBER) RETURN NUMBER

Returns converted amount.

Parameters
p_curr_code   Currency code (other than the base currency) to which the amount is to be converted. VARCHAR2(4) Required
p_rate_eff_date   Effective date used to find the rate for converting the amount. DATE Required
p_num_decimal   Number of decimals to round the converted amount. INTEGER Required
p_amount   Amount to be converted to another currency. NUMBER Required

Returns
Converted amount, or null if no rate is found for the currency code and effective date.


f_exists

FUNCTION f_exists(p_curr_code     gurcurr.gurcurr_curr_code%TYPE,
                  p_rate_eff_date gurcurr.gurcurr_rate_eff_date%TYPE,
                  p_rowid         VARCHAR2 DEFAULT NULL) RETURN VARCHAR2

Checks to see if a record exists.

Parameters
p_curr_code   Code that uniquely identifies a type of currency for which these conversion rates apply. VARCHAR2(4) Required Key
p_rate_eff_date   Effective date of the particular conversion rate. DATE Required Key
p_rowid   Database ROWID of record to select. VARCHAR2(18)

Returns
Y if found, otherwise N.


f_query_all

FUNCTION f_query_all(p_curr_code     gurcurr.gurcurr_curr_code%TYPE,
                     p_rate_eff_date gurcurr.gurcurr_rate_eff_date%TYPE)
  RETURN currency_rate_ref

Selects all records for the entity.

Parameters
p_curr_code   Code that uniquely identifies a type of currency for which these conversion rates apply. VARCHAR2(4) Required Key
p_rate_eff_date   Effective date of the particular conversion rate. DATE Required Key

Returns
A cursor variable that will fetch the set of records.


f_query_by_rowid

FUNCTION f_query_by_rowid(p_rowid VARCHAR2) RETURN currency_rate_ref

Selects one record using ROWID.

Parameters
p_rowid   Database ROWID of record to select. VARCHAR2(18) Required

Returns
A cursor variable that will fetch exactly one record.


f_query_one

FUNCTION f_query_one(p_curr_code     gurcurr.gurcurr_curr_code%TYPE,
                     p_rate_eff_date gurcurr.gurcurr_rate_eff_date%TYPE)
  RETURN currency_rate_ref

Selects one record using key.

Parameters
p_curr_code   Code that uniquely identifies a type of currency for which these conversion rates apply. VARCHAR2(4) Required Key
p_rate_eff_date   Effective date of the particular conversion rate. DATE Required Key

Returns
A cursor variable that will fetch exactly one record.


p_edit_calc

PROCEDURE p_edit_calc(curr_code_in       IN gurcurr.gurcurr_curr_code%TYPE,
                      foreign_amt_in     IN NUMBER,
                      curr_eff_date_in   IN gurcurr.gurcurr_rate_eff_date%TYPE,
                      num_decimal_in     IN INTEGER DEFAULT 4,
                      num_pre_decimal_in IN INTEGER DEFAULT 10,
                      converted_amt_out  OUT NUMBER,
                      error_msg_out      OUT VARCHAR2)

Edits the currency code and effective date, and returns the converted amount.

Parameters
curr_code_in   Currency code (other than the base currency) to which the amount is to be converted. VARCHAR2(4) Required
foreign_amount_in   Amount to be converted to another currency. NUMBER Required
curr_eff_date_in   Effective date used to find the rate for converting the amount. DATE Required
num_decimal_in   Number of decimals to round the converted amount. INTEGER
num_pre_decimal_in   Maximum number of digits to the left of the decimal. INTEGER
converted_amt_out   Return amount converted to base currency if no errors are encountered. NUMBER
error_msg_out   Return error message if an error is encountered. VARCHAR2