In previous articles, I introduced how to use struct to input multiple pieces of data to Oracle at a time in a Java program.
As we all know, at the end of the SQL statement, we need to make an explain Plan to ensure that there are no statements that affect performance.
The following method is used to explain struct and array:
1. Separate analysis:
Explain plan
Select * from table (dept_array (department_type (
1, -- DNO number (10 ),
'Name', -- name varchar2 (50 ),
'Location' -- location varchar2 (50)
) T;
Select * from table (dbms_xplan.display );
Result:
Plan_table_output
1 plan hash value: 1748000095
2
3 Cores ----------------------------------------------------------------------------------------------
4 | ID | operation | Name | rows | bytes | cost (% CPU) | time |
5 Cores ----------------------------------------------------------------------------------------------
6 | 0 | SELECT statement | 8168 | 16336 | 24 (0) | 00:00:01 |
7 | 1 | collection iterator constructor fetch |
8 bytes ----------------------------------------------------------------------------------------------
2. join other tables:
Explain plan
Select * from table (dept_array (department_type (
1, -- DNO number (10 ),
'Name', -- name varchar2 (50 ),
'Location' -- location varchar2 (50)
) T
Join Table2 T2 on T. DNO = t2.dno;
Select * from table (dbms_xplan.display );