| index

Package body mip_regions

Program units

reformat_postcode_string | Attempts to determine whether general the format the given string to match a standard postcode format
valid_postcode_format | Attempts to validate that the format of the given string matches a standard postcode format
get_region_for_postcode | Find the region with which the given postcode is associated

reformat_postcode_string

    FUNCTION reformat_postcode_string(p_string IN VARCHAR2) RETURN VARCHAR2

Attempts to determine whether general the format the given string to match a standard postcode format

Parameters

| p_string | the string whose format is to be checked

Returns

a known postcode format or NULL if the string did not match a known postcode format

| ANbNAA | e.g. M1 1AA
| ANNbNAA | e.g. M60 1NW
| AANbNAA | e.g. CR2 6XH
| AANNbNAA | e.g. DN55 1PT
| ANAbNAA | e.g. W1A 1HP
| AANAbNAA | e.g. EC1A 1BB

valid_postcode_format

    FUNCTION valid_postcode_format(p_postcode IN VARCHAR2) RETURN BOOLEAN

Attempts to validate that the format of the given string matches a standard postcode format
This includes the general format of the string, plus any restrictions on character values within the overall format.

Parameters

| p_string | the string whose format is to be checked

Returns

| TRUE if the given string matches a known postcode format

get_region_for_postcode

    FUNCTION get_region_for_postcode(p_postcode IN VARCHAR2)
      RETURN postcodes.regi_code%TYPE

Find the region with which the given postcode is associated

Parameters

| p_postcode | correctly formatted postcode

Returns

| region code