Search
 
SCRIPT & CODE EXAMPLE
 

SQL

PL SQL VARRAY of records

DECLARE
    TYPE r_customer_type IS RECORD(
        customer_name customers.NAME%TYPE,
        credit_limit customers.credit_limit%TYPE
    ); 
    
    TYPE t_customer_type IS VARRAY(2) 
        OF r_customer_type;

    t_customers t_customer_type := t_customer_type();
BEGIN
    t_customers.EXTEND;
    t_customers(t_customers.LAST).customer_name := 'ABC Corp';
    t_customers(t_customers.LAST).credit_limit  := 10000;
    
    t_customers.EXTEND;
    t_customers(t_customers.LAST).customer_name := 'XYZ Inc';
    t_customers(t_customers.LAST).credit_limit  := 20000;
    
    dbms_output.put_line('The number of customers is ' || t_customers.COUNT);
END;
/
Code language: SQL (Structured Query Language) (sql)
Comment

PREVIOUS NEXT
Code Example
Sql :: how to get initials in sql 
Sql :: uppercase sql 
Sql :: mysql show create table 
Sql :: declare table variable sql 
Sql :: laravel eloquent get generated sql 
Sql :: update column value in sql 
Sql :: function in postgresql 
Sql :: all tables and views oracle 
Sql :: psql no such file or directory 
Sql :: databricks install odbc driver connect to sql server 
Sql :: SQL column name Oracle 
Sql :: run function in sql 
Sql :: SQL Subtraction Operator 
Sql :: sql server check whether column has same equal values 
Sql :: mysql find duplicate rows multiple columns 
Sql :: mysql remove unique key 
Sql :: delete * from where id = 1; 
Sql :: location of the log postgresql linux 
Sql :: pgadmin see indexes 
Sql :: add week ending date sql server 
Sql :: sqlite 3 mac 
Sql :: sql join 
Sql :: mysql limit order by 
Sql :: insert into sql 
Sql :: porcentaje sql 
Sql :: copy column from one table to another without column duplicate postgres 
Sql :: decimal() mysql 
Sql :: make parameters nullable in sql server 
Sql :: how to recreate postgres database in docker 
Sql :: when matched in sql server 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =