Insert elements into table of varchar2 : Table of Varchar2 « PL SQL « Oracle PL / SQL






Insert elements into table of varchar2

    

SQL>
SQL>
SQL>  declare
  2      type myTextTableType is table of varchar2(200) index by binary_integer;
  3
  4      l_text_table     myTextTableType;
  5      l_empty_table    myTextTableType;
  6    begin
  7      l_text_table(10) := 'A value';
  8      l_text_table(20) := 'Another value';
  9      l_text_table(30) := 'Yet another value';
 10
 11      l_text_table(15) := 'some text';
 12      l_text_table(25) := 'some more text';
 13      dbms_output.put     ('After some assignments, we end up with ');
 14      dbms_output.put_line(l_text_table.count || ' varchar2s ');
 15      dbms_output.put_line('-');
 16
 17    end;
 18    /
After some assignments, we end up with 5 varchar2s
-

PL/SQL procedure successfully completed.

SQL>
SQL>
           
         
    
    
    
  








Related examples in the same category

1.Varchar table indexed by BINARY_INTEGER
2.VARRAYs, nested tables, index-by tables
3.Define 'table of varchar2' as data type and insert data
4.Table of varchar2 element count
5.Delete element in table of varchar2
6.Table of varchar2 delete all
7.Clear the table of varchar2
8.A NULL table, and a table with a NULL element.
9.Assign value to table records
10.Reference count property of table record
11.Call delete method with number on table record
12.Call delete method on table record
13.Assign value to table record after delete method call
14.Assing an empty table record to non-empty table record
15.first last next
16.dbms_sql.varchar2_table type
17.Assign to three elements of the table. Note that the key values are not sequential
18.behavior of NULL nested tables.
19.Declare a nested table with null values.
20.index by binary integer or by varchar2
21.Assign value to varchar2 collection by index
22.Assign values to subscripted members of the nested table.
23.Assign the first character index to a variable.
24.Assign the character index to a variable.
25.Allocate space as you increment the index.
26.You cannot traverse an associative array until elements are initialized.
27.Dynamic initialization and assignment in the execution section.