Les 05
Les 05
Les 05
Syntax:
TYPE type_name IS RECORD
(field_declaration[, field_declaration]…);
identifier type_name;
Example:
Examples:
Declare a variable to store the information about a
department from the DEPARTMENTS table.
dept_record departments%ROWTYPE;
Syntax:
TYPE type_name IS TABLE OF
{column_type | variable%TYPE
| table.column%TYPE} [NOT NULL]
| table.%ROWTYPE
[INDEX BY BINARY_INTEGER];
identifier type_name;
Declare an INDEX BY table to store names.
Example:
...
TYPE ename_table_type IS TABLE OF
employees.last_name%TYPE
INDEX BY BINARY_INTEGER;
ename_table ename_table_type;
...
1 Jones
2 Smith
3 Maduro
... ...
BINARY_INTEGER Scalar
DECLARE
TYPE ename_table_type IS TABLE OF
employees.last_name%TYPE
INDEX BY BINARY_INTEGER;
TYPE hiredate_table_type IS TABLE OF DATE
INDEX BY BINARY_INTEGER;
ename_table ename_table_type;
hiredate_table hiredate_table_type;
BEGIN
ename_table(1) := 'CAMERON';
hiredate_table(8) := SYSDATE + 7;
IF ename_table.EXISTS(1) THEN
INSERT INTO ...
...
END;
/
– EXISTS – NEXT
– COUNT – TRIM
– FIRST and LAST – DELETE
– PRIOR