PL/SQL Aggregate functions

PL/SQL is a procedural language designed for the Oracle Database management system. Oracle PL/SQL offers a number of aggregate functions that can be used to combine data from multiple rows into a single value. The PL/SQL aggregate functions can be used to perform calculations on sets of data. These functions are often used with the…(Continue Reading)

PL/SQL TIMESTAMP

The Oracle PL/SQL TIMESTAMP data type is used to store date and time data. Syntax The syntax for declaring a variable with the PL/SQL timestamp data type is as follows: variable_name TIMESTAMP; For example, you could declare a variable named start_date like this: declare start_date TIMESTAMP:=sysdate; begin DBMS_OUTPUT.PUT_LINE(‘start_date = ‘||start_date); end; You can also use…(Continue Reading)

PL/SQL VARCHAR2

The PL/SQL VARCHAR2 data type in Oracle database is used to store character strings of variable length. Syntax VARCHAR2(size) where size is the number of characters that the string can contain. Examples The maximum length of a VARCHAR2 data type used in a table column is 4000 characters. create table test_table( id number, comments varchar2(4000)…(Continue Reading)

PL/SQL PLS_INTEGER

The Oracle PL/SQL PLS_INTEGER data type is used to store numeric data. Syntax The syntax for using this data type is as follows: variable_name PLS_INTEGER; Example An example of using this data type is as follows: declare v_num PLS_INTEGER := 10; v_result PLS_INTEGER; begin if v_num = 10 then v_result:=100; end if; DBMS_OUTPUT.PUT_LINE(‘v_result = ‘||v_result);…(Continue Reading)

PL/SQL NUMBER

The Oracle PL/SQL NUMBER data type is used to store numeric values. It can be either an integer or a decimal number. Syntax The syntax for the NUMBER data type is as follows: number number(38) number(10,2) The first form, “number”, stores up to 38 digits. The second form, “number(38)”, stores up to 38 digits with…(Continue Reading)