Oracle Data type
A data type in a programming language is a set of data with values having predefined characteristics. Examples of data types are: integer, floating point unit number, character, string, and pointer. Usually, a limited number of such data types come built into a language. The language usually specifies the range of values for a given data type, how the values are processed by the computer, and how they are stored.
Few of the oracle data types can be found in the below link
Benefits of BINARY_FLOAT and BINARY_DOUBLE
BINARY_FLOAT and BINARY_DOUBLE are intended to complement the existing NUMBER type. BINARY_FLOAT and BINARY_DOUBLE offer the following benefits over NUMBER:
BINARY_FLOAT and BINARY_DOUBLE are intended to complement the existing NUMBER type. BINARY_FLOAT and BINARY_DOUBLE offer the following benefits over NUMBER:
- Smaller storage required BINARY_FLOAT and BINARY_DOUBLE require 5 and 9 bytes of storage space, whereas NUMBER might use up to 22 bytes.
- Greater range of numbers represented BINARY_FLOAT and BINARY_DOUBLE support numbers much larger and smaller than can be stored in a NUMBER.
- Faster performance of operations Operations involving BINARY_FLOAT and BINARY_DOUBLE are typically performed faster than NUMBER operations. This is because BINARY_FLOAT and BINARY_DOUBLE operations are typically performed in the hardware, whereas NUMBERs must first be converted using software before operations can be performed.
- Closed operations Arithmetic operations involving BINARY_FLOAT and BINARY_DOUBLE are closed, which means that either a number or a special value is returned.
- For example, if you divide a BINARY_FLOAT by another BINARY_FLOAT, a BINARY_FLOAT is returned.
- Transparent rounding BINARY_FLOAT and BINARY_DOUBLE use binary (base 2) to represent a number, whereas NUMBER uses decimal (base 10). The base used to represent a number affects how rounding occurs for that number. For example, a decimal floatingpoint number is rounded to the nearest decimal place, but a binary floating-point number is rounded to the nearest binary place.
Special Value Description
BINARY_FLOAT_NAN Not a number (NaN) for the BINARY_FLOAT type
BINARY_FLOAT_INFINITY Infinity (INF) for the BINARY_FLOAT type
BINARY_DOUBLE_NAN Not a number (NaN) for the BINARY_DOUBLE type
BINARY_DOUBLE_INFINITY Infinity (INF) for the BINARY_DOUBLE type
CREATE PROCEDURE pr_price (
p_product_id IN products.product_id%TYPE, -- the variable is of the type as the column product is in the table productp_factor IN NUMBER
) AS
product_count INTEGER;
BEGIN
-- count the number of products with the
-- supplied product_id (will be 1 if the product exists)
SELECT COUNT(*)
INTO product_count
FROM products
WHERE product_id = p_product_id;
-- if the product exists (i.e. product_count = 1) then
-- update that product's price
IF product_count = 1 THEN
UPDATE products
SET price = price * p_factor
WHERE product_id = p_product_id;
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
END pr_price;
/