SQL Tuning Tools   «Prev  Next»
Lesson 6

## Basic SQL tuning tools Conclusion

The purpose of this module was to provide you with skills and strategies to create and normalize SQL procedures for all parties involved in database management. DBAs who communicate with developers and developers about SQL procedures create much more effective and efficient systems.
We have covered some very important material in the chapter. The concepts include:

### Module Objectives

1. Identifying the roles of the DBA in SQL tuning
2. Enforcing SQL standards
3. Working with SQL developers
4. Using SQL in stored procedures
The next module will introduce you to tuning with the EXPLAIN PLAN utility.

## Implementing Methods

To implement a method, create the PL/SQL code and specify it within a CREATE TYPE BODY statement.
For example, consider the following definition of an object type named rational_type:

```CREATE TYPE rational_type AS OBJECT
( numerator INTEGER,
denominator INTEGER,
MAP MEMBER FUNCTION rat_to_real RETURN REAL,
MEMBER PROCEDURE normalize,
MEMBER FUNCTION plus (x rational_type)
RETURN rational_type);
```

The following definition is shown merely because it defines the function gcd, which is used in the definition of the normalize method in the CREATE TYPE BODY statement later in this section.
```CREATE FUNCTION gcd (x INTEGER, y INTEGER) RETURN INTEGER AS
-- Find greatest common divisor of x and y. For example, if
-- (8,12) is input, the greatest common divisor is 4.
-- This will be used in normalizing (simplifying) fractions.
-- (You need not try to understand how this code works, unless
--  you are a math wizard. It does.)
--
ans INTEGER;
BEGIN
IF (y <= x) AND (x MOD y = 0) THEN
ans := y;
ELSIF x < y THEN
ans := gcd(y, x);  -- Recursive call
ELSE
ans := gcd(y, x MOD y);  -- Recursive call
END IF;
RETURN ans;
END;
```

### SQL Management - Quiz

Before moving on to the next module, click the Quiz link below to test your understanding of some of the issues involved with SQL management.
SQL Management - Quiz