PL/SQL Collections: record type
SQL>
SQL> Set serverout on
SQL> declare
2 type location_record_type is record (
3 street_address varchar2(40),
4 postal_code varchar2(12),
5 city varchar2(30),
6 state_province varchar2(25),
7 country_id char(2) not null := 'US'
8 );
9
10 l_my_loc location_record_type;
11 begin
12 l_my_loc.street_address := '1 Way';
13 l_my_loc.postal_code := '22222';
14 l_my_loc.city := 'ABC';
15 l_my_loc.state_province := 'VA';
16 dbms_output.put_line( 'MY LOCATION IS:' );
17 dbms_output.put_line( l_my_loc.street_address );
18 dbms_output.put( l_my_loc.city||', '||l_my_loc.state_province );
19 dbms_output.put_line( ' '||l_my_loc.postal_code );
20 dbms_output.put_line( l_my_loc.country_id );
21 end;
22 /
MY LOCATION IS:
1 Way
ABC, VA 22222
US
PL/SQL procedure successfully completed.
SQL>
SQL>
Related examples in the same category