When executing each SQL statement, ORACLE much of the work carried out in the interior: parsing the SQL statement, the estimated index of utilization, bind variables, read data blocks, etc. Thus, reducing the number to access the database, you can actually. ORACLE reduce the workload.
E.g,
Here are three ways to retrieve the employee number equal to 0342 or 0291 staff of.
Method 1 (least efficient)
SELECT EMP_NAME , SALARY , GRADE
FROM EMP
WHERE EMP_NO = 342;
SELECT EMP_NAME , SALARY , GRADE
FROM EMP
WHERE EMP_NO = 291;
Method 2 (times inefficient)
DECLARE
CURSOR C1 (E_NO NUMBER) IS
SELECT EMP_NAME,SALARY,GRADE
FROM EMP
WHERE EMP_NO = E_NO;
BEGIN
OPEN C1(342);
FETCH C1 INTO …,..,.. ;
OPEN C1(291);
FETCH C1 INTO …,..,.. ;
CLOSE C1;
END;
Method 3 (high)
SELECT A.EMP_NAME , A.SALARY , A.GRADE,
B.EMP_NAME , B.SALARY , B.GRADE
FROM EMP A,EMP B
WHERE A.EMP_NO = 342
AND B.EMP_NO = 291;
Note :
ARRAYSIZE re-set parameters in SQL * Plus, SQL * Forms and Pro * C, you can increase the amount of data retrieved per database access, recommended value is 200.