In the world of PL / SQL functions or there are several ways to perform a desired command by a system manufacturer. One of them which I will discuss in my post this time of Procedure.

Procedure is a PL / SQL block where there is no returned value. So, inside the block there is only a command only. Where the execution takes its own syntax to run it.

The following procedure structure PL / SQL in general:

CREATE OR REPLACE PROCEDURE nama_procedure (tipe_data1 parameter1, parameter2 tipe_data2. Etc. ..) IS

BEGIN

        ...

Exception

        ...

END;

For more details, take a look at the example below:

CREATE OR REPLACE PROCEDURE IS number
    A NUMBER (2);
    FRI VARCHAR (20);
BEGIN
    A: = 0;
    SELECT COUNT (*) INTO A FROM TAB;
        IF A = 10 THEN FRI: = 'TEN';
           ELSIF FRI THEN A = 11: = 'ELEVEN';
           ELSIF FRI THEN A = 12: = 'TWELVE';
           ELSIF FRI THEN A = 13: = 'THIRTEEN';
           ELSIF FRI THEN A = 14: = 'Fourteen';
           ELSIF FRI THEN A = 15: = 'FIFTEEN';
        ELSE
           FRI: = 'A LOT';
END IF;
DBMS_OUTPUT.PUT_LINE ('Number of table' | | FRI);
END;

In PL / SQL block above, the procedure has a number of names, with A and FRI with each data type and length (length). In line 5, the parameter J is defined with a value of 0. While the commands contained in blocks, count the rows from the table TAB (row 6). In PL / SQL block is contained branching.

As for running the block:

in the SQL editor = exec procedure name (parameter1, parameter2, etc. ..);

                               exec sum (J, FRI);

Here was a brief description of How to create a procedure in PL / SQL. If there are shortcomings or mistakes please add or justified. May be useful ..

0 komentar

Related Posts Plugin for WordPress, Blogger...