Formatting API Use

This chapter covers the following topics:

Phone Parsing and Formatting APIs

PL/SQL Package Name: HZ_FORMAT_PHONE_V2PUB

Phone Number Parsing API

Description

Use this routine to parse a raw phone number into the country code, area code and subscriber number based on the setup of country and user phone preferences. Raw phone numbers are an entered string of digits that must include the subscriber number, and may include the international prefix, trunk prefix, country code, and area code. Depending on the country, the phone number may be entered in multiple formats. Each user may enter a number based on his or her personal preferences or location. This API is called from the Contact Point API, when creating or updating a contact point of PHONE type and when the raw phone number is passed to the API. The API returns the parsed country code, area code and subscriber number to the Contact Point API which populates these columns in the HZ_CONTACT_POINTS table.

Note: Setting up user preferences is intended for future release.

PL/SQL Procedure

PROCEDURE  phone_parse(
   p_init_msg_list       IN    VARCHAR2 := FND_API.G_FALSE,
   p_raw_phone_number    IN    VARCHAR2 := FND_API.G_MISS_CHAR, 
   p_territory_code      IN    VARCHAR2 := FND_API.G_MISS_CHAR,
   x_phone_country_code  OUT   VARCHAR2,
   x_phone_area_code     OUT   VARCHAR2,
   x_phone_number        OUT   VARCHAR2,
   x_mobile_flag         OUT   VARCHAR2,
   x_return_status       OUT   VARCHAR2, 
   x_msg_count           OUT   NUMBER,
   x_msg_data            OUT   VARCHAR2
)

Java Method

public static void phoneParse(
    OracleConnection _connection,
    String p_init_msg_list,
    String p_raw_phone_number,
    String p_territory_code,
    String  [] x_phone_country_code,
    String  [] x_phone_area_code,
    String  [] x_phone_number,
    String  [] x_mobile_flag,
    String  [] x_return_status,
    BigDecimal  [] x_msg_count,
    String  [] x_msg_data  ) throws SQLException;

Parameter Description and Validation

The following table lists information about the parameters in the Phone Number Parsing API. The table includes the parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
p_raw_phone_number IN VARCHAR2 No Validation : None
p_territory_code IN VARCHAR2 No Validation : None
Comment: Territory code parameter should be passed if the user preferences are not set up. This is the territory code of the input Raw Phone Number
x_phone_country_code OUT VARCHAR2   Comment : Parsed country code
x_phone_area_code OUT VARCHAR2   Comment : Parsed area code
x_phone_number OUT VARCHAR2   Comment : Parsed phone number
x_mobile_flag OUT VARCHAR2   Comment : Flag indicating whether the number is mobile or not.

Phone Number Formatting API

Description

Use this routine to format a phone number for display, based on the appropriate country phone format and the user's preferences. This includes which number segments to display as well as the inclusion of prefixes.

There are two overloaded procedures for this API. Use the first signature if the contact point ID for the phone number which is to be formatted is known. If not, use the second signature where the individual phone number components, country code, area code, and phone number, can be passed for formatting the phone number.

Note: Setting up user preferences is intended for future release.

PL/SQL Procedure

The p_contact_point_id parameter is only in the first procedure, which is used when the contact point ID of the phone number is known. These parameters are only in the second procedure, which is used when the contact point ID is unknown: p_territory_code, p_phone_country_code, p_phone_area_code, and p_phone_number.

PROCEDURE    phone_display(
   p_init_msg_list          IN   VARCHAR2 := FND_API.G_FALSE,
   p_contact_point_id       IN   NUMBER,
   p_territory_code         IN   VARCHAR2 := FND_API.G_MISS_CHAR,
   p_phone_country_code     IN   VARCHAR2 := FND_API.G_MISS_CHAR,
   p_phone_area_code        IN   VARCHAR2 := FND_API.G_MISS_CHAR,
   p_phone_number           IN   VARCHAR2 := FND_API.G_MISS_CHAR,
   x_formatted_phone_number OUT  VARCHAR2,
   x_return_status          OUT  VARCHAR2,
   x_msg_count              OUT  NUMBER,
   x_msg_data               OUT  VARCHAR2 
)

Java Method

The p_contact_point_id parameter is only in the first procedure, which is used when the contact point ID of the phone number is known. These parameters are only in the second procedure, which is used when the contact point ID is unknown: p_territory_code, p_phone_country_code, p_phone_area_code, and p_phone_number.

public static void phoneDisplay(
    OracleConnection _connection,
    String p_init_msg_list,
    BigDecimal p_contact_point_id,
    String p_territory_code,
    String p_phone_country_code,
    String p_phone_area_code,
    String p_phone_number,
    String  [] x_formatted_phone_number,
    String  [] x_return_status,
    BigDecimal  [] x_msg_count,
    String  [] x_msg_data
  ) throws SQLException;

Parameter Description and Validation

The following table lists information about the parameters in the Phone Number Formatting API. The table includes the parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
p_territory_code IN VARCHAR2 No Comment: Territory code parameter should be passed if the user preferences are not set up. This is the territory code of the input Raw Phone Number.
This parameter is only in the second procedure, which is used when the contact point ID of the phone number is unknown.
p_phone_country_code IN VARCHAR2 No Comment: This parameter is only in the second procedure, which is used when the contact point ID of the phone number is unknown.
p_phone_area_code IN VARCHAR2 No Comment: This parameter is only in the second procedure, which is used when the contact point ID of the phone number is unknown.
p_phone_number IN VARCHAR2 No Comment: This parameter is only in the second procedure, which is used when the contact point ID of the phone number is unknown.
p_contact_point_id IN NUMBER No Validation: Contact point type must be Phone.
Comment: Identifies the contact point in HZ_CONTACT_POINTS which needs to be formatted. This parameter is only in the first procedure, which is used when the contact point ID of the phone number is known.
x_formatted_phone_number OUT VARCHAR2 No Comment : Returns the number after formatting

Check Mobile Phone Number API

Description

Use this routine to check whether the country code, area code, and phone number combination is a mobile number. This API returns Y or N to indicate whether is it a mobile phone number or not.

PL/SQL Procedure

   PROCEDURE check_mobile_phone (
   p_init_msg_list      IN   VARCHAR2 := fnd_api.g_false,
   p_phone_country_code IN   VARCHAR2 := fnd_api.g_miss_char,
   p_phone_area_code    IN   VARCHAR2 := fnd_api.g_miss_char,
   p_phone_number       IN   VARCHAR2 := fnd_api.g_miss_char,
   x_mobile_flag        OUT  VARCHAR2,
   x_return_status      OUT  VARCHAR2,
   x_msg_count          OUT  NUMBER,
   x_msg_data           OUT  VARCHAR2)

Java Method

public static void checkMobilePhone(
    OracleConnection _connection,
    String p_init_msg_list,
    String p_phone_country_code,
    String p_phone_area_code,
    String p_phone_number,
    String  [] x_mobile_flag,
    String  [] x_return_status,
    BigDecimal  [] x_msg_count,
    String  [] x_msg_data  ) throws SQLException;

Name and Address Formatting APIs

PL/SQL Package Name: HZ_FORMAT_PUB

Name Formatting API

Description

The Name Formatting procedure formats the name of a person using a particular format (Style Format).

Two PL/SQL procedure signatures are available. Use the first if you know the party_id of the name that you want to format. The procedure queries for the party and formats the name. Otherwise, use the second signature, which accepts the individual components of a person's name as input. In addition, a function version that can be used in SELECT statements or views is available, which returns a single line.

Style Formats

Developers usually know only the style they plan to use, for example Informal Salutation, and prefer that the API determines which localized Style Format to use. In this case, you can pass the Style Code, and the procedure attempts to identify the specific localized Style Format based on the user's territory and language.

First, the user's reference locale is determined. This represents a reference territory and language for name and address formatting. These are usually supplied as parameters. If the territory and language are not supplied, they default from the profile options HZ: Reference Territory and HZ: Reference Language. If either of the profile options are not set, then the parameters default with the NLS Territory and NLS Language.

  1. Check for a Style Format (for the Style) matching both the user's reference language and territory combination.

  2. If not found, check for a Style Format for the style that matches the user's reference territory.

  3. If not found, check for a Style Format for the Style that matches the user's reference language.

  4. If not found, use the default Style Format that is defined for the Style.

To bypass this derivation logic and force the routine to use a specific Style Format, you can pass that as a parameter instead of the Style Code.

PL/SQL Procedure (known party_id)

PROCEDURE    format_name(
-- input parameters
    p_party_id            IN   NUMBER
    p_style_code          IN   NUMBER    DEFAULT NULL,
    p_style_format_code   IN   VARCHAR2  DEFAULT NULL,
    p_line_break          IN   VARCHAR2  DEFAULT NULL,
    p_space_replace       IN   VARCHAR2  DEFAULT NULL,
-- context parameters
    p_ref_language_code   IN   VARCHAR2  DEFAULT NULL,
    p_ref_territory_code  IN   VARCHAR2  DEFAULT NULL,
-- output parameters
    x_return_status       OUT  VARCHAR2
    x_msg_count           OUT  NUMBER
    x_msg_data            OUT  VARCHAR2
    x_formatted_name      OUT  VARCHAR2
    x_formatted_lines_cnt OUT  NUMBER
    x_formatted_name_tbl  OUT  HZ_FORMAT_PUB
.string_tbl_type
)

Java Method

public static void formatName(

    OracleConnection _connection,
    BigDecimal p_party_id,
    String p_style_code,
    String p_style_format_code,
    String p_line_break,
    String p_space_replace,
    String p_ref_language_code,
    String p_ref_territory_code,
    String  [] x_return_status,
    BigDecimal  [] x_msg_count,
    String  [] x_msg_data,
    String  [] x_formatted_name,
    BigDecimal  [] x_formatted_lines_cnt,
    ARRAY  [] x_formatted_name_tbl  ) throws SQLException;

Parameter Description and Validation

The following table lists information about the parameters in the Name Formatting API. The table includes the parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
p_party_id In Number Yes Comment: Party ID identifies the row in the HZ_PARTIES table for the person for which you wish to format the name.
p_style_code In Varchar2 No Comment: Supplied if the caller knows the Style, but wants the procedure to figure out the specific Style Format to apply. This is the usual case. This parameter is ignored if p_style_format_code is passed.
p_style_format_code In Varchar2 No Comment: Supplied if the caller wishes to specifically use a known Style Format to the address, for example to override the one that the procedure would usually choose.
p_line_break In Varchar2 No Comment: Characters to use to separate multiple lines. For example, <br> for HTML output.
p_space_replace In Varchar2 No Comment: Characters to substitute for blank valued delimiters. For example, &nbsp; for HTML output.
p_ref_language_code In Varchar2 No Comment: Reference Language (context).
Default: Profile option HZ: Reference Language or else the current session NLS Language setting.
p_ref_territory_code In Varchar2 No Comment: Reference Territory (context).
Default: Profile option HZ: Reference Territory or else the current session NLS Territory setting.
x_return_status Out Varchar2 Yes Comment: Return status of API.
  • S=Success

  • E=Error

  • U=Unexpected Error

x_msg_count Out Number Yes Comment: Number of error messages returned.
x_msg_data Out Number Yes Comment: Text of messages returned.
x_formatted_name Out Varchar2 Yes Comment: The formatted name returned as a single string with line breaks.
x_formatted_lines_cnt Out Number Yes Comment: The number of lines in the formatted name.
x_formatted_name_tbl Out String_Tbl_Type Yes Comment: The formatted name returned as multiple strings, one for each line.

PL/SQL Procedure (unknown party_id)

PROCEDURE    format_name(
-- input parameters
    p_style_code                     IN  NUMBER    DEFAULT NULL,
    p_style_format_code              IN  VARCHAR2  DEFAULT NULL,
    p_line_break                     IN  VARCHAR2  DEFAULT NULL,
    p_space_replace                  IN  VARCHAR2  DEFAULT NULL,
-- person name components
    p_person_title                   IN   VARCHAR2  DEFAULT NULL,
    p_person_first_name              IN   VARCHAR2  DEFAULT NULL,
    p_person_middle_name             IN   VARCHAR2  DEFAULT NULL,
    p_person_last_name               IN   VARCHAR2  DEFAULT NULL,
    p_person_suffix                  IN   VARCHAR2  DEFAULT NULL,
    p_person_person_known_as         IN   VARCHAR2  DEFAULT NULL,
    p_person_first_name_phonetic     IN   VARCHAR2  DEFAULT NULL,
    p_person_middle_name_phonetic    IN   VARCHAR2  DEFAULT NULL,
    p_person_last_name_phonetic      IN   VARCHAR2  DEFAULT NULL,
-- context parameters
    p_ref_language_code              IN   VARCHAR2  DEFAULT NULL,
    p_ref_territory_code             IN   VARCHAR2  DEFAULT NULL,
-- output parameters
    x_return_status                  OUT  VARCHAR2
    x_msg_count                      OUT  NUMBER
    x_msg_data                       OUT  VARCHAR2
    x_formatted_name                 OUT  VARCHAR2
    x_formatted_lines_cnt            OUT  NUMBER
    x_formatted_name_tbl             OUT  HZ_FORMAT_PUB.string_tbl_type
)

Java Method

public static void formatName(

    OracleConnection _connection,
    String p_style_code,
    String p_style_format_code,
    String p_line_break,
    String p_space_replace,
    String p_ref_language_code,
    String p_ref_territory_code,
    String p_person_title,
    String p_person_first_name,
    String p_person_middle_name,
    String p_person_last_name,
    String p_person_name_suffix,
    String p_person_known_as,
    String p_first_name_phonetic,
    String p_middle_name_phonetic,
    String p_last_name_phonetic,
    String  [] x_return_status,
    BigDecimal  [] x_msg_count,
    String  [] x_msg_data,
    String  [] x_formatted_name,
    BigDecimal  [] x_formatted_lines_cnt,
    ARRAY  [] x_formatted_name_tbl  ) throws SQLException; 

Parameter Description and Validation

The following table only lists information specifically about the second of the two signatures available for this procedure. Refer to this table and the table for the first signature for information about parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
p_person_title In Varchar2 No Comment: conventional, professional, or honorific title such as Mrs. or Dr.
p_person_first_name In Varchar2 No Comment: person's first name
p_person_middle_name In Varchar2 No Comment: person's middle name
p_person_last_name In Varchar2 No Comment: person's last name
p_person_suffix In Varchar2 No Comment: name suffix. For example, in English, a common custom to distinguish offspring with same given names is to use a generation indicator. The suffix can be a Roman numeral such as II or III, or a string such as Jr. or Sr.
p_person_known_as In Varchar2 No Comment: alternative or also- known-as (AKA) name
p_first_name_phonetic In Varchar2 No Comment: phonetic representation of person's first name
p_first_middle_phonetic In Varchar2 No Comment: phonetic representation of person's middle name
p_first_last_phonetic In Varchar2 No Comment: phonetic representation of person's last name

There is also a function version of the format_name procedure that can be used in a SQL statement.

PL/SQL Function

FUNCTION    format_name(
-- input parameters
    p_party_id             IN          NUMBER
    p_style_code           IN          NUMBER        DEFAULT NULL,
    p_style_format_code    IN          VARCHAR2      DEFAULT NULL,
    p_line_break           IN          VARCHAR2      DEFAULT NULL,
    p_space_replace        IN          VARCHAR2      DEFAULT NULL,
-- context parameters
    p_ref_language_code    IN          VARCHAR2      DEFAULT NULL,
    p_ref_territory_code   IN          VARCHAR2      DEFAULT NULL 

) RETURN VARCHAR2

Java Method

public static String formatName(
    OracleConnection _connection,
    BigDecimal p_party_id,
    String p_style_code,
    String p_style_format_code,
    String p_line_break,
    String p_space_replace,
    String p_ref_language_code,
    String p_ref_territory_code  ) throws SQLException;

Parameter Description and Validation

Refer to the parameter descriptions and validations for the format_name procedure for information about parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Address Formatting API

Description

The Address Formatting procedure formats an address using a particular format (Style Format).

Two PL/SQL procedure signatures are available. Use the first if you know the location_id of the address you want to format. The procedure queries for the location and formats the address. Otherwise, use the second signature, which accepts the individual address components as input. In addition, a function version that can be used in SELECT statements or views is available, which returns a single line.

Style Formats

The API will accept one of two parameters for determining format: the Style code or the Style Format code. Normally, the developer would know only the style they wish to use, such as Mailing Address with multiple lines, and would prefer to have the API figure out which localized Style Format to use. In this case, you can pass the Style, and the procedure attempts to find the specific Style Format based on the territory where the address is located.

If you know the specific Style Format you wish to use, such as the France Mailing Address, and you want the API to use this Style Format, regardless of having the API determine which Style Format to use, then you can pass it as a parameter. This mode is provided for flexibility, but this way of using the procedure is generally not the case.

Both parameters are optional. If you do not pass either parameter, then the HZ: Default Address Style profile option determines the default address Style. The Style Format will be determined by the address's territory.

If you do want to pass style information, you should pass either the Style Format or the Style parameter, but not both. If you pass both, the Style Format parameter takes precedence, and the Style parameter will be ignored.

PL/SQL Procedure

PROCEDURE    format_address(
-- input parameters
    p_location_id              IN    NUMBER
    p_style_code               IN    NUMBER     DEFAULT NULL,
    p_style_format_code        IN    VARCHAR2   DEFAULT NULL,
    p_line_break               IN    VARCHAR2   DEFAULT NULL,
    p_space_replace            IN    VARCHAR2   DEFAULT NULL,
-- context parameters
    p_to_language_code         IN    VARCHAR2   DEFAULT NULL,
    p_country_name_lang        IN    VARCHAR2   DEFAULT NULL,
    p_from_territory_code      IN    VARCHAR2   DEFAULT NULL,
-- output parameters
    x_return_status            OUT   VARCHAR2
    x_msg_count                OUT   NUMBER
    x_msg_data                 OUT   VARCHAR2
    x_formatted_address        OUT   VARCHAR2
    x_formatted_lines_cnt      OUT   NUMBER
    x_formatted_address_tbl    OUT   HZ_FORMAT_PUB.string_tbl_type
)

Java Method

public static void formatAddress(
    OracleConnection _connection,
    BigDecimal p_location_id,
    String p_style_code,
    String p_style_format_code,
    String p_line_break,
    String p_space_replace,
    String p_to_language_code,
    String p_country_name_lang,
    String p_from_territory_code,
    String  [] x_return_status,
    BigDecimal  [] x_msg_count,
    String  [] x_msg_data,
    String  [] x_formatted_address,
    BigDecimal  [] x_formatted_lines_cnt,
    ARRAY  [] x_formatted_address_tbl  ) throws SQLException; 

Parameter Description and Validation

The following table lists information about the parameters in the Address Formatting API. The table includes the parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
p_location_id In Number Yes Comment: Location ID identifies the row in the HZ_LOCATIONS table for which you wish the address formatted.
p_style_code In Varchar2 No Comment: Supplied if the caller knows the Style, but wants the procedure to figure out the specific Style Format to apply. This is the usual case.
This parameter is ignored if p_style_format_code is passed.
p_style_format_code In Varchar2 No Comment: Supplied if the caller wishes to specifically use a known Style Format to the address, for example to override the one that the procedure would usually choose.
p_line_break In Varchar2 No Comment: Characters to use to separate multiple lines. For example, <br> for HTML output.
p_space_replace In Varchar2 No Comment: Characters to substitute for blank valued delimiters. For example, &nbsp; for HTML output.
p_to_language_code In Varchar2 No Comment: Language that is used at the destination location.
p_country_name_lang In Varchar2 No Comment: Language used to display the country name
Default: Profile option HZ: Language for country name, or if not set then the current session NLS Language setting.
p_from_territory_code In Varchar2 No Comment: Territory of the sender.
Default: Profile option HZ: Reference Territory, or if not set then current session NLS Territory setting.
x_return_status Out Varchar2 Yes Comment: Return status of API.
  • S=Success

  • E=Error

  • U=Unexpected Error

x_msg_count Out Number Yes Comment: Number of error messages returned.
x_msg_data Out Number Yes Comment: Text of messages returned.
x_formatted_address Out Varchar2 Yes Comment: The formatted address returned as a single string with line breaks.
x_formatted_lines_cnt Out Number Yes Comment: The number of lines in the formatted address.
x_formatted_address_tbl Out String_Tbl_Type Yes Comment: The formatted address returned as multiple strings, one for each line.

PL/SQL Procedure

PROCEDURE format_address (
-- input
    p_style_code            IN   VARCHAR2 DEFAULT NULL,
    p_style_format_code    IN   VARCHAR2 DEFAULT NULL,
    p_line_break            IN   VARCHAR2 DEFAULT NULL,
    p_space_replace                IN   VARCHAR2 DEFAULT NULL,
-- optional context parameters    
    p_to_language_code          IN      VARCHAR2 DEFAULT NULL,
    p_country_name_lang         IN      VARCHAR2 DEFAULT NULL,
    p_from_territory_code       IN      VARCHAR2 DEFAULT NULL,
-- address components
    p_address_line_1            IN      VARCHAR2 DEFAULT NULL,
    p_address_line_2            IN      VARCHAR2 DEFAULT NULL,
    p_address_line_3            IN      VARCHAR2 DEFAULT NULL,
    p_address_line_4            IN      VARCHAR2 DEFAULT NULL,
    p_city                               IN     VARCHAR2 DEFAULT NULL,
    p_postal_code  IN   VARCHAR2 DEFAULT NULL,
    p_state                     IN      VARCHAR2 DEFAULT NULL,
    p_province     IN   VARCHAR2 DEFAULT NULL,
    p_county                    IN      VARCHAR2 DEFAULT NULL,
    p_country                   IN      VARCHAR2 DEFAULT NULL,
    p_address_lines_phonetic    IN      VARCHAR2 DEFAULT NULL,
-- output parameters
    x_return_status             OUT     VARCHAR2,
    x_msg_count                 OUT     NUMBER,
    x_msg_data                  OUT     VARCHAR2,
    x_formatted_address         OUT     VARCHAR2,
    x_formatted_lines_cnt       OUT     NUMBER,
    x_formatted_address_tbl     OUT     string_tbl_type);

Java Method

public static void formatAddress(
    OracleConnection _connection,
    String p_style_code,
    String p_style_format_code,
    String p_line_break,
    String p_space_replace,
    String p_to_language_code,
    String p_country_name_lang,
    String p_from_territory_code,
    String p_address_line_1,
    String p_address_line_2,
    String p_address_line_3,
    String p_address_line_4,
    String p_city,
    String p_postal_code,
    String p_state,
    String p_province,
    String p_county,
    String p_country,
    String p_address_lines_phonetic,
    String  [] x_return_status,
    BigDecimal  [] x_msg_count,
    String  [] x_msg_data,
    String  [] x_formatted_address,
    BigDecimal  [] x_formatted_lines_cnt,
    ARRAY  [] x_formatted_address_tbl  ) throws SQLException;

Parameter Description and Validation

The following table only lists information specifically about the second of the two signatures available for this procedure. Refer to this table and the table for the first signature for information about parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
p_address_line_1 In Varchar2 No Comment: address line 1
p_address_line_2 In Varchar2 No Comment: address line 2
p_address_line_3 In Varchar2 No Comment: address line 3
p_address_line_4 In Varchar2 No Comment: address line 4
p_city In Varchar2 No Comment: City
p_postal_code In Varchar2 No Comment: Postal code or ZIP code
p_state In Varchar2 No Comment: State
p_province In Varchar2 No Comment: Province
p_county In Varchar2 No Comment: County
p_country In Varchar2 No Comment: Country of the address
p_address_lines_phonetic In Varchar2 No Comment: Phonetic representation of the address

There is also a function version of the format_address procedure that can be used in a SQL statement.

PL/SQL Function

FUNCTION    format_address(
-- context parameters
    p_location_id              IN      NUMBER
    p_style_code               IN      NUMBER      DEFAULT NULL,
    p_style_format_code        IN      VARCHAR2    DEFAULT NULL,
    p_line_break               IN      VARCHAR2    DEFAULT NULL,
    p_space_replace            IN      VARCHAR2    DEFAULT NULL,
-- input parameters
    p_to_language_code         IN      VARCHAR2    DEFAULT NULL,
    p_country_name_lang        IN      VARCHAR2    DEFAULT NULL,
    p_from_territory_code      IN      VARCHAR2    DEFAULT NULL
)  RETURN VARCHAR2

Java Method

public static String formatAddress(
    OracleConnection _connection,
    BigDecimal p_location_id,
    String p_style_code,
    String p_style_format_code,
    String p_line_break,
    String p_space_replace,
    String p_to_language_code,
    String p_country_name_lang,
    String p_from_territory_code  ) throws SQLException;

Parameter Description and Validation

The information about the parameters of this signature is the same as the information about the parameters for the first format_address signature. Refer to the table above for the appropriate parameter information.

General Data Formatting API

Description

The solutions provided for name and address formatting can be used to format any type of information from any data source. This generic formatting routine provides a way for you set up the Style Metadata for the data you wish to format.

PL/SQL Procedure

PROCEDURE    format_data(
-- input parameters
    p_object_code             IN     VARCHAR2
    p_object_key_1            IN     VARCHAR2
    p_object_key_2            IN     VARCHAR2
    p_object_key_3            IN     VARCHAR2
    p_object_key_4            IN     VARCHAR2
    p_style_code              IN     NUMBER      DEFAULT NULL,
    p_style_format_code       IN     VARCHAR2    DEFAULT NULL,
    p_line_break              IN     VARCHAR2    DEFAULT NULL,
    p_space_replace           IN     VARCHAR2    DEFAULT NULL,
-- context parameters
    p_ref_language_code       IN     VARCHAR2    DEFAULT NULL,
    p_ref_territory_code      IN     VARCHAR2    DEFAULT NULL,
-- output parameters
    x_return_status           OUT    VARCHAR2
    x_msg_count               OUT    NUMBER
    x_msg_data                OUT    VARCHAR2
    x_formatted_data          OUT    VARCHAR2
    x_formatted_lines_cnt     OUT    NUMBER

    x_formatted_data_tbl      OUT    HZ_FORMAT_PUB.string_tbl_type
)

Java Method

public static void formatData(
    OracleConnection _connection,
    String p_object_code,
    String p_object_key_1,
    String p_object_key_2,
    String p_object_key_3,
    String p_object_key_4,
    String p_style_code,
    String p_style_format_code,
    String p_line_break,
    String p_space_replace,
    String p_ref_language_code,
    String p_ref_territory_code,
    String  [] x_return_status,
    BigDecimal  [] x_msg_count,
    String  [] x_msg_data,
    String  [] x_formatted_data,
    BigDecimal  [] x_formatted_lines_cnt,
    ARRAY  [] x_formatted_data_tbl  ) throws SQLException;

Parameter Description and Validation

The following table lists information about the parameters in the General Data Formatting API. The table includes the parameter names, the type of each parameter, the data type of each parameter, the necessity of the parameter, and other information about the parameter such as validation, defaults, and other comments.

Parameter Name Type Data Type Required Validation, Default, Comment
p_object_code In Varchar2 No Comment: Object code, such as table name or view name, for which you want the data formatted.
p_object_key_1 In Varchar2 No Object keys combination form the primary key of the object for which you wish the data formatted.
p_object_key_2 In Varchar2 No  
p_object_key_3 In Varchar2 No  
p_object_key_4 In Varchar2 No  
p_style_code In Varchar2 No Comment: Supplied if the caller knows the style, but wants the procedure to figure out the specific style format to apply, which is the usual case. This parameter is ignored if p_style_format_code is passed.
p_style_format_code In Varchar2 No Comment: Supplied if the caller wants to use a known style format to the address, for example to override the one that the procedure would usually choose.
p_line_break In Varchar2 No Comment: Characters to use to separate multiple lines, for example <br> for HTML output.
p_space_replace In Varchar2 No Comment: Characters to substitute for blank valued delimiters, for example, &nsbp; for HTML output.
p_ref_language_code In Varchar2 No Comment: Reference Language (context).
Default: The value from the HZ: Reference Language profile option or the current session NLS Language setting.
p_ref_territory_code In Varchar2 No Comment: Reference Territory (context).
Default: The value from the HZ: Reference Territory profile option or the current session NLS Territory setting.
x_formatted_data Out Varchar2 No Comment: The formatted output data.