index

Package gb_common

This package provides utility functions and procedures for the Banner APIs.
 
Some of these includes functions for formatting error messages, generating PIDMs, IDs, address sequence numbers, telephone sequence numbers, and the p_commit and p_rollback procedures that are used to end transactions and appropriately publish or discard messages.


Program units
f_api_version   Returns the API version number.
f_current_id_exists   Checks to see if a current ID exists in SPRIDEN table.
f_err_msg_add_delim   Adds standard delimiters to the beginning and
f_err_msg_remove_delim   Removes standard delimiters from p_error_message.
f_err_msg_remove_delim_tbl   Breaks p_error_message into a table, one message per record, and replaces the delimiters with gb_common_strings.ERR_SEPARATOR.
f_generate_id   Generates a Banner ID number for the Identification entity (SPRIDEN table).
f_generate_pidm   Generates a PIDM for the Identification entity (SPRIDEN table).
f_get_api_name   Returns a Banner API package name for a given table.
f_get_api_table   Returns the name of the table upon which a Banner API has been built.
f_get_context   Returns a Banner API context variable value.
f_get_id   Returns the ID number that corresponds to the current SPRIDEN record for a given PIDM.
f_get_next_addr_seqno   Returns the next highest address sequence number for the given PIDM and Address Type code.
f_get_next_tele_seqno   Returns the next highest telephone sequence number for the given PIDM.
f_get_pidm   Returns the PIDM corresponding to the SPRIDEN record with the given ID.
f_id_exists   Checks to see if an ID already exists.
f_pidm_exists   Checks to see if a PIDM already exists.
f_sct_user   Returns the Oracle user id of the current session.
p_commit   Commits the transaction and publishes the message.
p_rollback   Rolls back the transaction and discards any pending message data.
p_set_context   Defines a Banner API Context Variable and value.
f_vbs_error_msg   Returns the value of the CHECK_POLICY_MSG constant.
f_vbs_error_number   Returns the value of the CHECK_POLICY_NUMBER constant.

Types
err_type   Defines the maximum length of all API error message strings.
errmsg_tab_type   This is declaration for API error message type table.
msgtab   This is used to build a simple table of strings indexed by integer.
internal_record_id_type   The type that will be used to declare Oracle ROWIDs in various API record definitions and parameters.

Constants
CHECK_POLICY_NUMBER   Check Policy exception Number
CHECK_POLICY_MSG   Check Policy Error Message
DATA_ORIGIN   All Banner programs are to define the data_origin column with this string.
M_INTERNAL_RECORD_ID   Defines the string that identifies the ROWID parameter for messaging.


err_type

SUBTYPE err_type IS VARCHAR2 (4000);

Defines the maximum length of all API error message strings.
NOTE: This type should not be used, it is an artifact. Use gb_common_strings.err_type instead.


CHECK_POLICY_NUMBER

CHECK_POLICY_NUMBER   CONSTANT NUMBER := -28115;

Check Policy exception Number


CHECK_POLICY_MSG

CHECK_POLICY_MSG      CONSTANT err_type :=
  g$_nls.get('x','SQL','Security violation, transaction not complete.');

Check Policy Error Message


DATA_ORIGIN

DATA_ORIGIN            CONSTANT VARCHAR2 (6)            := 'Banner';

All Banner programs are to define the data_origin column with this string.


M_INTERNAL_RECORD_ID

M_INTERNAL_RECORD_ID   CONSTANT VARCHAR2 (10)           := '@ROWID';

Defines the string that identifies the ROWID parameter for messaging.


errmsg_tab_type

TYPE errmsg_tab_type IS TABLE OF err_type INDEX BY VARCHAR2(30);

This is declaration for API error message type table.
NOTE: This type should not be used, it is an artifact.
Use gb_common_strings.errmsg_tab_type instead.


msgtab

TYPE msgtab IS TABLE OF VARCHAR2 (2000) INDEX BY BINARY_INTEGER;

This is used to build a simple table of strings indexed by integer.


internal_record_id_type

SUBTYPE internal_record_id_type IS VARCHAR2(18);

The type that will be used to declare Oracle ROWIDs in various API record definitions and parameters.


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_current_id_exists

FUNCTION f_current_id_exists(p_id spriden.spriden_id%TYPE) RETURN VARCHAR2

Checks to see if a current ID exists in SPRIDEN table.

Parameters
p_id   Identification number used to access the person on-line. VARCHAR2(9) Required

Returns
Y if ID exists in SPRIDEN with change indicator NULL, otherwise returns N.


f_err_msg_add_delim

FUNCTION f_err_msg_add_delim(p_error_message VARCHAR2 DEFAULT NULL)
  RETURN VARCHAR2

Adds standard delimiters to the beginning and
 end of the string if not already there.

Parameters
p_error_message   Any error message string. VARCHAR2.

Returns
p_error_message with delimiters at the beginning and end.


f_err_msg_remove_delim

FUNCTION f_err_msg_remove_delim(p_error_message VARCHAR2 DEFAULT NULL)
  RETURN VARCHAR2

Removes standard delimiters from p_error_message.

Parameters
p_error_message   The error message string. VARCHAR2.

Returns
p_error_message with the delimiters replaced by gb_common_strings.ERR_SEPARATOR.


f_err_msg_remove_delim_tbl

FUNCTION f_err_msg_remove_delim_tbl(p_error_message VARCHAR2 DEFAULT NULL)
  RETURN msgtab

Breaks p_error_message into a table, one message per record, and replaces the delimiters with gb_common_strings.ERR_SEPARATOR.

Parameters
p_error_message   The error message string. VARCHAR2.

Returns
msgtab with the delimiters replaced by gb_common_strings.ERR_SEPARATOR.


f_generate_id

FUNCTION f_generate_id RETURN VARCHAR2

Generates a Banner ID number for the Identification entity (SPRIDEN table).
 
If the literal 'GENERATED' is passed to the Identification API (gb_identification) in the p_id parameter, it will call this function to generate the next available ID.
This function may be replaced with local code if some other scheme is required for generating ID numbers.

Returns
The next available Banner ID number.


f_generate_pidm

FUNCTION f_generate_pidm RETURN NUMBER

Generates a PIDM for the Identification entity (SPRIDEN table).
 
This function may be replaced with local code if some other scheme is required for generating PIDMS.

Returns
The next available PIDM.


f_get_api_name

FUNCTION f_get_api_name(p_packageschema VARCHAR2,
                        p_table_name    VARCHAR2) RETURN VARCHAR2

Returns a Banner API package name for a given table.
 
Searches the ALL_DEPENDENCIES system view for a DML package for the given table, then locates the API package that calls that DML package.  Assumes both the DML package and API packages conform to the Banner Business API naming conventions.
Ignores the dml_common and gb_common packages.

Parameters
p_packageschema   The schema that owns the API package being looked for.
p_table_name   The name of a Banner table for which an API has been built.

Returns
The name of the API package built for the given table. Returns null if no package is found.


f_get_api_table

FUNCTION f_get_api_table(p_packageschema VARCHAR2,
                         p_api_package   VARCHAR2) RETURN VARCHAR2

Returns the name of the table upon which a Banner API has been built.
 
Searches the ALL_DEPENDENCIES system view for a reference to the given package.
Then it tries to locate the DML package that is called by that package, and extracts the table name of the DML package.

Parameters
p_packageschema   The schema that owns the API package.
p_api_package   The name of an API package.

Returns
The name of the table that the API was built on. Returns NULL of no table is found.


f_get_context

FUNCTION f_get_context(p_package_name VARCHAR2,
                       p_context_name VARCHAR2) RETURN VARCHAR2

Returns a Banner API context variable value.
 
A Banner API context variable may be defined by an application to control the behavior of an API. This function is used by the API to determine if one of these variables has been defined, and see what it's value is.

Returns
The value of the context variable, if defined. Otherwise return NULL.


f_get_id

FUNCTION f_get_id(p_pidm spriden.spriden_pidm%TYPE) RETURN VARCHAR2

Returns the ID number that corresponds to the current SPRIDEN record for a given PIDM.

Parameters
p_pidm   Internal identification number. NUMBER(8) Required

Returns
The spriden_id for this PIDM where spriden_change_ind is NULL.


f_get_next_addr_seqno

FUNCTION f_get_next_addr_seqno(p_pidm      spraddr.spraddr_pidm%TYPE,
                               p_atyp_code spraddr.spraddr_atyp_code%TYPE)
  RETURN NUMBER

Returns the next highest address sequence number for the given PIDM and Address Type code.

Parameters
p_pidm   Internal identification number. NUMBER(8) Required
p_atyp_code   Type of address associated with the person. VARCHAR2(2) Required Key

Returns
The next highest address sequence number for the given PIDM and Address Type code.


f_get_next_tele_seqno

FUNCTION f_get_next_tele_seqno(p_pidm sprtele.sprtele_pidm%TYPE)
  RETURN NUMBER

Returns the next highest telephone sequence number for the given PIDM.

Parameters
p_pidm   Internal identification number. NUMBER(8) Required

Returns
The next highest telephone sequence number for the given PIDM.


f_get_pidm

FUNCTION f_get_pidm(p_id spriden.spriden_id%TYPE) RETURN NUMBER

Returns the PIDM corresponding to the SPRIDEN record with the given ID.

Parameters
p_id   Identification number used to access the person on-line. VARCHAR2(9) Required Key

Returns
The PIDM corresponding to the SPRIDEN record with the given ID.


f_id_exists

FUNCTION f_id_exists(p_id spriden.spriden_id%TYPE) RETURN VARCHAR2

Checks to see if an ID already exists.

Parameters
p_id   Identification number used to access the person on-line. VARCHAR2(9) Required Key

Returns
Y if ID exists anywhere in SPRIDEN, otherwise returns N.


f_pidm_exists

FUNCTION f_pidm_exists(p_pidm spriden.spriden_pidm%TYPE) RETURN VARCHAR2

Checks to see if a PIDM already exists.

Parameters
p_pidm   Internal identification number. NUMBER(8) Required

Returns
Y if the PIDM exists anywhere in SPRIDEN, otherwise returns N.


f_sct_user

FUNCTION f_sct_user RETURN VARCHAR2

Returns the Oracle user id of the current session.
This may be set at login time by Oracle, or by proxy login from an external system.

Returns
SYS_CONTEXT('USERENV','SESSION_USER')


p_commit

PROCEDURE p_commit(p_do_not_commit VARCHAR2 DEFAULT NULL)

Commits the transaction and publishes the message.
 
Only commits the message data if messaging is enabled on the system. Determined by f_entity_publishable function.

Parameters
p_do_not_commit   For testing. If not null, it does not COMMIT the transaction but it does publish the message.


p_rollback

PROCEDURE p_rollback(p_do_not_rollback VARCHAR2 DEFAULT NULL)

Rolls back the transaction and discards any pending message data.
 
Only discards the message data if messaging is enabled on the system. Determined by f_entity_publishable function.

Parameters
p_do_not_rollback   For testing. If not null, does not ROLLBACK the transaction but does discard the message.


p_set_context

PROCEDURE p_set_context(p_package_name  VARCHAR2,
                        p_context_name  VARCHAR2,
                        p_context_value VARCHAR2,
                        p_stateless_ind VARCHAR2 DEFAULT 'Y')

Defines a Banner API Context Variable and value.
 
One or more Banner API Context Variables can be defined by an application to control the behavior of an API. The names and values are set by the application and read by the API.

Parameters
p_package_name   Name of the package that is expected to use the variable. Currently unused but required.
p_context_name   Any character string. Used as the name of the variable.
p_context_value   Any character string. Used as the value of the variable.
p_stateless_ind   Determines if the value persists between calls. If Y, the value is set to null on the first call to p_get_context. Otherwise, it is left unchanged until the application session ends or the application explicitly sets it to null.


f_vbs_error_msg

FUNCTION f_vbs_error_msg RETURN VARCHAR2

Returns the value of the CHECK_POLICY_MSG constant.

Returns
the value of the CHECK_POLICY_MSG constant.


f_vbs_error_number

FUNCTION f_vbs_error_number RETURN NUMBER

Returns the value of the CHECK_POLICY_NUMBER constant.

Returns
the value of the CHECK_POLICY_NUMBER constant.