PL/SQL (MOSC)

MOSC Banner

Associated array is auto-sorted when adding elements (or just reference first element?)

I have below code

create type sortable_t is object

(

    month varchar2(32767),

    value number         

);

/

-- PL/SQL nested tables

create type sortable_table_t is table of sortable_t;

set serveroutput on

declare

    type string_asc_arr_t is table of number

        index by varchar2(20);

    l_str string_asc_arr_t;

    l_idx varchar2(32767);

    sorted sortable_table_t := sortable_table_t();

begin

    l_str('JAN-MAR') := 90;   

    l_str('JUL-SEP') := 92;

    l_str('OCT-DEC') := 93;

    l_str('APR-JUN') := 91;

   

    l_idx := l_str.FIRST;

   

    while l_idx is not null loop

        dbms_output.put_line('Current ' || l_idx);

        sorted.extend(1);

        sorted(sorted.last) := new sortable_t(l_idx,l_str(l_idx));

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center