Blob
Blob

Reputation: 541

Passing values from Array to Text Fields on Apex Form

I am using the following pl/sql in a process to separate some text, which is then displayed and put into two text fields for saving the record. I cannot see anything wrong with the following however when i run the process on my APEX it says 'ORA-01403: no data found'. Is this the correct method of passing the values held in an array to the text fields on my APEX Form?

declare

v_array apex_application_global.vc_arr2;

begin

-- Convert delimited string to array
v_array := apex_util.string_to_table(:P1_OPERATION_JOB,'^');

:P1_ORDER := v_array(1);
:P1_LOCATION := v_array(2);

end;

Upvotes: 2

Views: 1926

Answers (1)

Tom
Tom

Reputation: 7028

You can indeed retrieve values from the array like that. However, getting the ORA-01403 error would indicate that there is no data at either of the positions. (Oracle throws this error when trying to access data at a position with no data in a plsql array, and the same error when a select into retrieves no data)

I'd run this code just to make sure of the output of your split:

DECLARE
    l_vc_arr2    APEX_APPLICATION_GLOBAL.VC_ARR2;
BEGIN
    apex_debug_message.log_message('Debugging string to table output:');
    l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(:P1_OPERATION_JOB, '^');
    FOR z IN 1..l_vc_arr2.count LOOP
        apex_debug_message.log_message('Item at position '||z||': '||l_vc_arr2(z));
    END LOOP;
END;

Run the page with debug enabled and check the debug messages for the output of the loop. There most likely is no value at one of the positions you're trying to access.

Upvotes: 2

Related Questions