index

Package gp_goksdif

FILE NAME..: gokp_goksdif0.sql RELEASE....: 8.4 OBJECT NAME: gp_goksdif PRODUCT....: GENERAL USAGE......:Package contains functions and procedures
              to implement the Supplemental data interface.
COPYRIGHT..: Copyright 2006 - 2010 SunGard. All rights reserved.
 
DESCRIPTION:
 
  This package defines process layer interface for SDE use.
 
DESCRIPTION END Public constant declarations


Program units
p_insert_disc   Insert Discriminator values into temporary table GOTSDCR.
f_get_pk   Get the Concatenated Primary key for a Banner record.
f_sd_exists   Check if supplemental data exists for the Banner record.
p_set_current_pk   Set the Concatenated primary key as a private package variable before selecting the supplemental attribute values from GOVSDAV.
f_get_current_pk   Get the Concatenated primary key set in p_set_current_pk.
p_set_attribute   As SD is not an entity on its own, there is no standard API.
p_set_attribute   Overloaded p_set_attribute where value is specified as a VARCHAR2
p_set_attribute   Overloaded p_set_attribute where value is specified as sys.anydata
f_validate_sde_testing   In order to be authorized to test GJAPDEF or GORRSQL validations the user must have the special security access for any of the following:
f_validate_value   As SDE is not an entity on its own, there is no standard API.
f_cast   Cast a clob to sys.anydata
f_cast   Cast a VARCHAR2 to sys.anydata
f_to_any   Convert VARCHAR2 to sys.anydata
f_to_any   Convert NUMBER to sys.anydata
f_to_any   Convert DATE to sys.anydata
f_to_varchar2   Convert sys.anydata to VARCHAR2
f_get_sd_text   Get a supplemental data text by key
p_set_attributes   Set multiple attributes
p_delete_attributes   Set delete all attributes
p_change_key   Change the parent key value for suplemental attributes

Types
t_attr_tab  
t_name_tab  
t_disc_tab  


t_attr_tab

TYPE t_attr_tab IS TABLE OF SYS.ANYDATA;

t_name_tab

TYPE t_name_tab IS TABLE OF VARCHAR2(30);

t_disc_tab

TYPE t_disc_tab IS TABLE OF GORSDAV.GORSDAV_DISC%TYPE;

p_insert_disc

PROCEDURE p_insert_disc(p_table_name VARCHAR2)

Insert Discriminator values into temporary table GOTSDCR.
To be called when the block (thus basetable) is changed, before querying Supplemental Data in a form.
Used in view GOVSDAV.

Parameters
p_table_name   SD Parent Table Name.


f_get_pk

FUNCTION f_get_pk(p_table_name VARCHAR2,
                  p_rowid      VARCHAR2) RETURN VARCHAR2

Get the Concatenated Primary key for a Banner record.
To be called when a new record is selected in the Banner block.

Parameters
p_table_name   SD Parent Table Name.
p_rowid   ROWID of record in table.

Returns
The concatenated key values of the Banner record separated by chr(1)


f_sd_exists

FUNCTION f_sd_exists(p_table VARCHAR2,
                     p_pk    VARCHAR2 := NULL) RETURN VARCHAR2

Check if supplemental data exists for the Banner record.

Parameters
p_table_name   SD Parent Table Name.
p_pk   The concatenated key values of the Banner record separated by chr(1)

Returns
Y if true N if false


p_set_current_pk

PROCEDURE p_set_current_pk(p_pk VARCHAR2)

Set the Concatenated primary key as a private package variable before selecting the supplemental attribute values from GOVSDAV.

Parameters
p_pk   The concatenated key values of the Banner record separated by chr(1)


f_get_current_pk

FUNCTION f_get_current_pk RETURN VARCHAR2

Get the Concatenated primary key set in p_set_current_pk.
Used in view GOVSDAV.
Perhaps it would be better to use a SYS_CONTEXT variable instead.

Returns
the Concatenated primary key set in p_set_current_pk.


p_set_attribute

PROCEDURE p_set_attribute(p_table_name     VARCHAR2,
                          p_attr_name      VARCHAR2,
                          p_disc           VARCHAR2,
                          p_pk_parenttab   VARCHAR2 := NULL,
                          p_gorsdav_rowid  IN OUT VARCHAR2,
                          p_attr_data_type VARCHAR2,
                          p_value_as_clob  CLOB)

As SD is not an entity on its own, there is no standard API.
Instead the DML for supplemental data values is handled by procedure p_set_attribute.

Parameters
p_table_name   SD Parent Table Name.
p_attr_name   Attribute Name.
p_disc   Discriminator Value. Although this is a primary key field, update is allowed in order to support the 'insert' of attribute values in the middle of a sequence of attribute values, without recreating existing attributes. The primary key constraint is deferred to allow this.
p_pk_parenttab   Concatenated primary key in parent table.
p_gorsdav_rowid   The rowid of the attribute record. If NULL it is a new attribute value(will be inserted).
p_attr_data_type   The data type of the attribute.
p_value_as_clob   The value to set represented as a CLOB in the current session format. If value is NULL, the attribute value record will be deleted.


p_set_attribute

PROCEDURE p_set_attribute(p_table_name     VARCHAR2,
                          p_attr_name      VARCHAR2,
                          p_disc           VARCHAR2,
                          p_pk_parenttab   VARCHAR2 := NULL,
                          p_gorsdav_rowid  IN OUT VARCHAR2,
                          p_attr_data_type VARCHAR2,
                          p_value_as_char  VARCHAR2)

Overloaded p_set_attribute where value is specified as a VARCHAR2

Parameters
p_value_as_char   The value to set represented as a VARCHAR2 in the current session format.


p_set_attribute

PROCEDURE p_set_attribute(p_table_name    VARCHAR2,
                          p_attr_name     VARCHAR2,
                          p_disc          VARCHAR2,
                          p_pk_parenttab  VARCHAR2 := NULL,
                          p_gorsdav_rowid IN OUT VARCHAR2,
                          p_value         sys.anydata)

Overloaded p_set_attribute where value is specified as sys.anydata

Parameters
p_value   The value as it will be saved in the database


f_validate_sde_testing

FUNCTION f_validate_sde_testing(p_table_name      VARCHAR2,
                                p_form_or_process VARCHAR2 := NULL,
                                p_test_type       VARCHAR2) RETURN VARCHAR2

In order to be authorized to test GJAPDEF or GORRSQL validations the user must have the special security access for any of the following:
  * SDE_SQL_TESTING - Allows the 'Test Data' process to test any GJAPDEF or GORRSQL
                      NOTE: If a user has SDE_SQL_VALIDATION then they can also test
  * SDE_LOV_ - Allows the user to modify data on GTVSDLV for the specified table
                      The table may be 'DEFAULT' to modify the generic tables if applicable
                      The table may be 'ALL' to indicate they can update any table on GTVSDLV
                      i.e. SDE_LOV_ALL, SDE_LOV_SPRIDEN, SDE_LOV_DEFAULT
                      NOTE: Since they can modify the LOV's, they can also test them
  * SDE_TEST_
- Allows the user to test LOVs for the specified table with 'Test Data'
                      The table may be 'DEFAULT' to test the generic tables if applicable
                      The table may be 'ALL' to indicate they can test any table on GTVSDLV
                      i.e. SDE_TEST_ALL, SDE_TEST_SPRIDEN, SDE_TEST_DEFAULT
Note: In order to allow everyone to update and test all fields of GOASDMD you should create SDE_SQL_VALIDATION and SDE_LOV_ALL and assign them to the BAN_GENERAL_C class
@p_form_or_process The only process name that will verify access if 'GOASDMD Testing'
@p_test_type Either SQL to verify GORRSQL or LOV

Parameters
p_table_name   The table name for which access is being requested

Returns
error message if the access is denied failed. 'Y' if access is permintted


f_validate_value

FUNCTION f_validate_value(p_table_name      IN VARCHAR2,
                          p_attr_name       IN VARCHAR2,
                          p_disc            IN VARCHAR2 := NULL,
                          p_pk_parenttab    IN VARCHAR2 := NULL,
                          p_attr_data_type  IN VARCHAR2,
                          p_form_or_process IN VARCHAR2 := NULL,
                          p_value_as_char   IN OUT VARCHAR2)
  RETURN VARCHAR2

As SDE is not an entity on its own, there is no standard API.
Instead the validation for data values is handled by function f_validate_value.

Parameters
p_table_name   SD Parent Table Name.
p_attr_name   Attribute Name.
p_disc   Discriminator Value. Although this is a primary key field, update is allowed in order to support the 'insert' of attribute values in the middle of a sequence of attribute values, without recreating existing attributes. The primary key constraint is deferred to allow this.
p_pk_parenttab   Concatenated primary key in parent table.
p_attr_data_type   The data type of the attribute.
p_form_or_process   The form or process from where the validation is occuring. Only used to optionally pass to external validation routines.
p_value_as_char   The value to set represented as a VARCHAR2 in the current session format. This is an IN OUT parameter specifically to allow dates to be changed upon edit. i.e. returning current date if an alpha character is input

Returns
error message if the validation failed. 'Y' if the validation was successful


f_cast

FUNCTION f_cast(p_attr_data_type VARCHAR2,
                p_clob           CLOB) RETURN sys.anydata

Cast a clob to sys.anydata

Parameters
p_attr_data_type   the datatype of the attribute
p_clob   the clob value to Cast

Returns
p_clob casted to anydata


f_cast

FUNCTION f_cast(p_attr_data_type VARCHAR2,
                p_char           VARCHAR2) RETURN sys.anydata

Cast a VARCHAR2 to sys.anydata

Parameters
p_attr_data_type   the datatype of the attribute
p_char   the VARCHAR2 value to Cast

Returns
p_char casted to anydata


f_to_any

FUNCTION f_to_any(p_char VARCHAR2) RETURN sys.anydata

Convert VARCHAR2 to sys.anydata

Parameters
p_char   VARCHAR2 input value

Returns
p_char converted to sys.anydata


f_to_any

FUNCTION f_to_any(p_num NUMBER) RETURN sys.anydata

Convert NUMBER to sys.anydata

Parameters
p_num   NUMBER input value

Returns
p_num converted to sys.anydata


f_to_any

FUNCTION f_to_any(p_date DATE) RETURN sys.anydata

Convert DATE to sys.anydata

Parameters
p_date   DATE input value

Returns
p_date converted to sys.anydata


f_to_varchar2

FUNCTION f_to_varchar2(p_anydata sys.anydata) RETURN VARCHAR2

Convert sys.anydata to VARCHAR2

Parameters
p_char   sys.anydata input value

Returns
p_char converted to VARCHAR2


f_get_sd_text

FUNCTION f_get_sd_text(p_table_name IN VARCHAR2,
                       p_attr_name  IN VARCHAR2,
                       p_pk         IN VARCHAR2,
                       p_disc       IN VARCHAR2,
                       p_default    IN VARCHAR2 := NULL) RETURN VARCHAR2

Get a supplemental data text by key

Parameters
p_table_name   the name of the table
p_attr_name   the attribute name
p_pk   the primary key concatenation
p_disc   the discriminator value
p_default   the default value returned when no sd exists

Returns
the attribute value


p_set_attributes

PROCEDURE p_set_attributes(p_table_name    IN VARCHAR2,
                           p_pk            IN VARCHAR2,
                           p_attr_names    IN t_name_tab,
                           p_disc_vals     IN t_disc_tab,
                           p_attr_vals     IN t_attr_tab,
                           p_attr_vals_old IN t_attr_tab := NULL)

Set multiple attributes

Parameters
p_table_name   the name of the table
p_pk   the primary key concatenation
p_attr_names;   a collection of attribute names
p_disc_vals;   a collection of discriminator values
p_attr_vals;   a collection of attribute values
p_attr_vals_old;   a collection of old attribute values


p_delete_attributes

PROCEDURE p_delete_attributes(p_table_name IN VARCHAR2,
                              p_pk         IN VARCHAR2)

Set delete all attributes

Parameters
p_table_name   the name of the table
p_pk   the primary key concatenation


p_change_key

PROCEDURE p_change_key(p_table_name IN VARCHAR2,
                       p_pk_old     IN VARCHAR2,
                       p_pk_new     IN VARCHAR2)

Change the parent key value for suplemental attributes

Parameters
p_table_name   the name of the table
p_pk_old   the old primary key concatenation
p_pk_new   the new primary key concatenation