Oracle PL / SQL Has several built-in / built-in operators, which are:
- Arithmetic Operator (Arithmetic Operator)
- Relational Operator
- Operators Comparison (Comparison Operator)
- Logical Operator
Arithmetic Operator
Arithmetic operator is an operator used to perform arithmetic / mathematical operations. Below is a table of all kinds of Arithmetic Operators in PL / SQL:
Example: As an exercise example, try typing the PL / SQL program below in your favorite SQL Editor.
BEGIN
dbms_output.put_line('1 + 4 = '|| (1 + 4));
dbms_output.put_line('7 - 2 = '|| (7 - 2));
dbms_output.put_line('3 * 10 = '|| (3 * 10));
dbms_output.put_line('100 / 2 = '|| (100 / 2));
END;
/
Output if executed
1 + 4 = 5 7 - 2 = 5 3 * 10 = 30 100 / 2 = 50 PL/SQL procedure successfully completed.
Relational Operators
Relational operators are used to compare two expressions or values of two operands. This operator has a value return / return value true or false.
DECLARE
x number (2) := 21;
y number (2) := 10;
BEGIN
dbms_output.put_line('nilai x = '||x);
dbms_output.put_line('nilai y = '||y);
IF (x = y) then
dbms_output.put_line('Value of x is more than y value');
ELSE
dbms_output.put_line('nilai x tidak sama dengan nilai y');
END IF;
IF (x < y) then
dbms_output.put_line('Value of x is not equal to value y');
ELSE
dbms_output.put_line('Value of x is more than y value');
END IF;
IF ( x > y ) THEN
dbms_output.put_line('Value of x is more than y value');
ELSE
dbms_output.put_line('Value of x less than y value');
END IF;
IF ( x <= y ) THEN
dbms_output.put_line('Value of x less than or equal to y');
END IF;
IF ( x >= y ) THEN
dbms_output.put_line('Value of x more than or equal to y');
END IF;
IF ( x <> y ) THEN
dbms_output.put_line('The value of x is not equal to y');
ELSE
dbms_output.put_line('Value x equals y');
END IF;
END;
/
Output if executed
nilai x = 21 nilai y = 10 nilai x Not equal to value y nilai x More than value y nilai x More than value y nilai x More than or equal to y nilai x not equal to y PL/SQL procedure successfully completed.





