Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
quantity integer oracle database sqlwhen adding ro

Quantity integer oracle database sqlwhen adding row this table

Chapter 12: Database Objects 383

DESCRIBE t_product
Name Null? Type
----------------------------------------- -------- ------------ ID NUMBER(38) NAME VARCHAR2(10) DESCRIPTION VARCHAR2(22) PRICE NUMBER(5,2) DAYS_VALID INTEGER

Column Objects
The following example creates a table named products that contains a column named product of type t_product; the table also contains a column named quantity_in_stock, which is used to store the number of those products currently in stock:

CREATE TABLE products (
product t_product,
quantity_in_stock INTEGER
);

A constructor is a built-in method for the object type, and it has the same name as the object type; the constructor accepts parameters that are used to set the attributes of the new object. The constructor for the t_product type is named t_product and accepts five parameters, one to set each of the attributes; for example, t_product(1, pasta, 20 oz bag of pasta, 3.95, 10) creates a new t_product object and sets its id to 1, name to pasta, description to 20 oz bag of pasta, price to 3.95, and days_valid to 10.

The following INSERT statements add two rows to the products table; notice the use of the t_product constructor to supply the attribute values for the product column objects:

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Erika Kelly

PageId: DOCF29DC7C