: Modify Table Structure
The change in the structure of the tables using ALTER to:
- Add new columns to tables.
- Modify the width of the column.
- Modify the data type of the column (in this case the column must have data).
- Change the length of a column.
EXAMPLE 1: ALTER TABLE Customers
ADD (integer balance, branch char)
In the previous example we add to the Customers table column Balance integer and column type Branch character.
EXAMPLE 2: ALTER TABLE Customers
MODIFY (name char (50));
In the previous example modify the length of the field Name of the Customers table that was kind of character that was char (40) to char (50)
Friday, September 26, 2008
Animation Images Of Pregnant Mother
ORACLE - Create Sequences for autonumber fields
numerical encoding such a product can be made with the creation of a automatically generated sequence of integers in ascending order, is not necessary to remember what was the last number assigned, thus avoiding the duplication of codes.
The sequence is an object that generates unique integer values \u200b\u200bare used to create numeric primary key, using the following command: CREATE SEQUENCE
codigo_producto INCREMENT BY 1 START WITH 100;
In this case the first number generated will be 100, because we put that start from 100
To register a new code with the previously defined sequence used codigo_producto.NEXTVAL column, which will give us the following value that corresponds to the sequence.
For the current value of the sequence, ie, the last assigned code is used codigo_producto.CURRVAL column from system table DUAL, whose purpose is to consult pseudo_columnas:
SELECT user, sysdate, codigo_producto. currval FROM DUAL;
where: 1 .-
user is the user name
2 .- sysdate is the date the system
codigo_producto.currval 3 .- is the last value assigned to the sequence.
EXAMPLE:
PRODUCTOS_SUC INSERT INTO VALUES (codigo_producto.NEXTVAL, 'SHOES');
numerical encoding such a product can be made with the creation of a automatically generated sequence of integers in ascending order, is not necessary to remember what was the last number assigned, thus avoiding the duplication of codes.
The sequence is an object that generates unique integer values \u200b\u200bare used to create numeric primary key, using the following command: CREATE SEQUENCE
codigo_producto INCREMENT BY 1 START WITH 100;
In this case the first number generated will be 100, because we put that start from 100
To register a new code with the previously defined sequence used codigo_producto.NEXTVAL column, which will give us the following value that corresponds to the sequence.
For the current value of the sequence, ie, the last assigned code is used codigo_producto.CURRVAL column from system table DUAL, whose purpose is to consult pseudo_columnas:
SELECT user, sysdate, codigo_producto. currval FROM DUAL;
where: 1 .-
user is the user name
2 .- sysdate is the date the system
codigo_producto.currval 3 .- is the last value assigned to the sequence.
EXAMPLE:
PRODUCTOS_SUC INSERT INTO VALUES (codigo_producto.NEXTVAL, 'SHOES');
Monday, September 22, 2008
Popsicle Bridges For Dummies
ORACLE - Conversion Functions: TO_NUMBER
The TO_NUMBER function converts a text into a number.
The syntax is:
TO_NUMBER (string1, [format_mask], [nls_language])
string1 is a text that will want to be converted into numbers.
format_mask is optional. This is the format that will be used to convert string1 in number
nls_language is optional. This is the language used to convert string1 in number.
Example:
TO_NUMBER ('981 .53 '9999.99') returns the number
981.53 TO_NUMBER ('225 ', '999') will return the number 225
TO_NUMBER ('23 ', '99') will return the number 23
Both the format and language are optional, so you can turn text into a simple number, eg
TO_NUMBER ('1210 .73 '') Would return the number 1210.73
The TO_NUMBER function converts a text into a number.
The syntax is:
TO_NUMBER (string1, [format_mask], [nls_language])
string1 is a text that will want to be converted into numbers.
format_mask is optional. This is the format that will be used to convert string1 in number
nls_language is optional. This is the language used to convert string1 in number.
Example:
TO_NUMBER ('981 .53 '9999.99') returns the number
981.53 TO_NUMBER ('225 ', '999') will return the number 225
TO_NUMBER ('23 ', '99') will return the number 23
Both the format and language are optional, so you can turn text into a simple number, eg
TO_NUMBER ('1210 .73 '') Would return the number 1210.73
Subscribe to:
Posts (Atom)