Oracle9iAS Portal Developer Kit

set_value procedure

Contained in package wwa_api_module_session.

Call this procedure to set the (date, number, varchar2) value of an attribute.

Note: If the name of a form component attribute is EMPNO, the name of the attribute in the session data would be A_EMPNO.

If you build a form component based on a table/view, session data attributes are available under the block named DEFAULT. If you build a master-detail form, the corresponding session data attributes for the master section are available under the block named MASTER_BLOCK and the detail section are available under DETAIL_BLOCK.

member procedure set_value
(
   p_block_name in varchar2,
   p_attribute_name in varchar2,
   p_value in date,
   p_index in integer default 1
),

member procedure set_value
(
   p_block_name in varchar2,
   p_attribute_name in varchar2,
   p_value in number,
   p_index in integer default 1
),

member procedure set_value
(
   p_block_name in varchar2,
   p_attribute_name in varchar2,
   p_value in varchar2,
   p_index in integer default 1
),

Version: Oracle Portal 3.0.9

Parameters:

p_block_name

The name of the block that owns the attribute.

Datatype: varchar2

p_attribute_name

The name of the attribute.

Datatype: varchar2

p_value

The value of the attribute.

Datatype: date, number, varchar2

p_index

The index of the value, for n-valued attributes.

Datatype: integer
Default: 1

Exceptions:

If the attribute's type indicates that the implementation type is incorrect, exception VALUE_ERROR is raised.

Example 1:

Consider an Oracle Portal form component based on the SCOTT.EMP table (module_id=7). To set values for the EMPNO, ENAME and HIREDATE attributes, i.e. A_EMPNO, A_ENAME and A_HIREDATE session data attributes:

declare
    l_session wwa_api_module_session;
begin
        l_session := <portal_schema>.wwa_api_module_session.create_session (
                           p_module_id => 7,
                           p_version  => 1
                       );

        --- Setting value for A_EMPNO i.e. EMPNO attribute of the form       
        l_session.set_value(
            p_block_name => 'DEFAULT',
            p_attribute_name => 'A_EMPNO',
            p_value => 555);

        --- Setting value for A_ENAME i.e. ENAME attribute of the form
        l_session.set_value(
            p_block_name => 'DEFAULT',
            p_attribute_name => 'A_ENAME',
            p_value => 'NEW EMP');

        --- Setting value for A_HIREDATE i.e HIREDATE attribute of the form
        l_session.set_value(
            p_block_name => 'DEFAULT',
            p_attribute_name => 'A_HIREDATE',
            p_value => to_date('14-FEB-01','DD-MON-RR') );
end;

As this form component is based on a table/view, there is a single instance of each form attribute. Therefore the index is not passed and it takes the default value of 1.

For a master-detail form component the detail section has 'n' instances of a detail section attribute. Where n=number of detail rows, as specified in the detail section while building the form.

Example 2:

Consider an Oracle Portal master-detail form component built on the DEPT-EMP table where the number of detail rows is 5. If the module_id of the form component is 9, to set the values of the DNAME form attribute and the first two instances of the EMPNO attribute:

declare
    l_session wwa_api_module_session;
begin
        l_session := <portal_schema>.wwa_api_module_session.create_session (
                           p_module_id => 9,
                           p_version  => 1
                       );

        --- Setting value of the A_DNAME i.e DNAME attribute of MASTER
        l_session.set_value(
            p_block_name => 'MASTER_BLOCK',
            p_attribute_name => 'A_DNAME',
            p_value => 'NEW DEPT');

        --- Setting values of the A_EMPNO i.e EMPNO attribute of DETAIL
        l_session.set_value(
            p_block_name => 'DETAIL_BLOCK',
            p_attribute_name => 'A_EMPNO',
            p_value => 777,
            p_index => 1);

        l_session.set_value(
            p_block_name => 'DETAIL_BLOCK',
            p_attribute_name => 'A_EMPNO',
            p_value => 999,
            p_index => 2);
end;

Related topics

The PL/SQL API Reference is part of the Portal Developer Kit on Portal Studio