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)

PL/SQL INT

The PL/SQL INT data type in Oracle database is used to store whole numbers. Syntax The syntax for declaring a variable of type INT is: variable_name INT; Example For example, the following declaration creates a variable called var_int: declare var_int INT; begin var_int := 10; dbms_output.put_line(‘1. var_int = ‘||var_int); var_int := var_int * 2; dbms_output.put_line(‘2.…(Continue Reading)