SlideShare une entreprise Scribd logo
1  sur  30
Oracle for
Beginners
BY: Jigar M.
What is Oracle
– Oracle database is a relational database management system. It is known as
Oracle database, Oracle DB or simply Oracle. It is produced and marketed by
Oracle Corporation.
– Oracle database is the first database designed for enterprise grid computing.
The enterprise grid computing provides the most flexible and cost effective way
to manage information and applications.
Different editions of Oracle
database
Following are the four editions of the Oracle database.
– Enterprise Edition: It is the most robust and secure edition. It offers all features,
including superior performance and security.
– Standard Edition: It provides the base functionality for users that do not require
Enterprise Edition's robust package.
– Express Edition (XE): It is the lightweight, free and limited Windows and Linux
edition.
– Oracle Lite: It is designed for mobile devices
Introduction to Oracle Datatypes
– Oracle provides the following categories of built-in datatypes:
– Overview of Character Datatypes
– Overview of Numeric Datatypes
– Overview of DATE Datatype
– Overview of LOB Datatypes
Overview of Character
Datatypes
– The character datatypes store character (alphanumeric) data in strings, with
byte values corresponding to the character encoding scheme, generally called a
character set or code page.
– The database's character set is established when you create the database.
Examples of character sets are 7-bit ASCII (American Standard Code for
Information Interchange), EBCDIC (Extended Binary Coded Decimal Interchange
Code), Code Page 500, Japan Extended UNIX, and Unicode UTF-8. Oracle
supports both single-byte and multibyte encoding schemes.
CHAR Datatype
– The CHAR datatype stores fixed-length character strings. When you create a
table with a CHAR column, you must specify a string length (in bytes or
characters) between 1 and 2000 bytes for the CHAR column width. The default
is 1 byte. Oracle then guarantees that:
 When you insert or update a row in the table, the value for the CHAR column has the
fixed length.
 If you give a shorter value, then the value is blank-padded to the fixed length.
 If a value is too large, Oracle Database returns an error.
VARCHAR2 and VARCHAR
Datatypes
– The VARCHAR2 datatype stores variable-length character strings. When you create a
table with a VARCHAR2 column, you specify a maximum string length (in bytes or
characters) between 1 and 4000 bytes for the VARCHAR2 column. For each row,
Oracle Database stores each value in the column as a variable-length field unless a
value exceeds the column's maximum length, in which case Oracle Database returns
an error. Using VARCHAR2 and VARCHAR saves on space used by the table.
– For example, assume you declare a column VARCHAR2 with a maximum size of 50
characters. In a single-byte character set, if only 10 characters are given for the
VARCHAR2 column value in a particular row, the column in the row's row piece
stores only the 10 characters (10 bytes), not 50.
VARCHAR Datatype
– The VARCHAR datatype is synonymous with the VARCHAR2 datatype. To avoid
possible changes in behavior, always use the VARCHAR2 datatype to store
variable-length character strings.
NCHAR and NVARCHAR2
Datatypes
– NCHAR and NVARCHAR2 are Unicode datatypes that store Unicode character
data. The character set of NCHAR and NVARCHAR2 datatypes can only be either
AL16UTF16 or UTF8 and is specified at database creation time as the national
character set. AL16UTF16 and UTF8 are both Unicode encoding.
 The NCHAR datatype stores fixed-length character strings that correspond to the
national character set.
 The NVARCHAR2 datatype stores variable length character strings.
Contd.
NCHAR
– The maximum length of an NCHAR column is 2000 bytes. It can hold up to 2000
characters. The actual data is subject to the maximum byte limit of 2000. The
two size constraints must be satisfied simultaneously at run time.
NVARCHAR2
– The maximum length of an NVARCHAR2 column is 4000 bytes. It can hold up to
4000 characters. The actual data is subject to the maximum byte limit of 4000.
The two size constraints must be satisfied simultaneously at run time.
LOB Character Datatypes
– The LOB datatypes for character data are CLOB and NCLOB. They can store up to
8 terabytes of character data (CLOB) or national character set data (NCLOB).
Note:
– Do not create tables with LONG columns. Use LOB columns (CLOB, NCLOB) instead.
LONG columns are supported only for backward compatibility.
– Oracle also recommends that you convert existing LONG columns to LOB columns.
LOB columns are subject to far fewer restrictions than LONG columns. Further, LOB
functionality is enhanced in every release, whereas LONG functionality has been
static for several releases
LONG Datatype
– Columns defined as LONG can store variable-length character data containing
up to 2 gigabytes of information. LONG data is text data that is to be
appropriately converted when moving among different systems.
– LONG datatype columns are used in the data dictionary to store the text of view
definitions. You can use LONG columns in SELECT lists, SET clauses of UPDATE
statements, and VALUES clauses of INSERT statements.
Overview of Numeric Datatypes
– The numeric datatypes store positive and negative fixed and floating-point
numbers, zero, infinity, and values that are the undefined result of an operation
(that is, is "not a number" or NAN).
– This section includes the following topics:
– NUMBER Datatype
– Floating-Point Numbers
NUMBER Datatype
– The NUMBER datatype stores fixed and floating-point numbers. Numbers of
virtually any magnitude can be stored and are guaranteed portable among
different systems operating Oracle Database, up to 38 digits of precision.
– For numeric columns, you can specify the column as:
– column_name NUMBER
– Optionally, you can also specify a precision (total number of digits) and scale
(number of digits to the right of the decimal point):
– column_name NUMBER (precision, scale)
Floating-Point Numbers
– Oracle Database provides two numeric datatypes exclusively for floating-point
numbers: BINARY_FLOAT and BINARY_DOUBLE.
– This section includes the following topics:
– BINARY_FLOAT Datatype
– BINARY_DOUBLE Datatype
Contd
BINARY_FLOAT Datatype
– BINARY_FLOAT is a 32-bit, single-precision floating-point number datatype. Each
BINARY_FLOAT value requires 5 bytes, including a length byte.
BINARY_DOUBLE Datatype
– BINARY_DOUBLE is a 64-bit, double-precision floating-point number datatype.
Each BINARY_DOUBLE value requires 9 bytes, including a length byte.
Overview of DATE Datatype
– The DATE datatype stores point-in-time values (dates and times) in a table. The
DATE datatype stores the year (including the century), the month, the day, the
hours, the minutes, and the seconds (after midnight).
– For input and output of dates, the standard Oracle date format is DD-MON-YY,
as follows:'13-NOV-92'
– You can change this default date format for an instance with the parameter
NLS_DATE_FORMAT.
– TO_DATE ('November 13, 1992', 'MONTH DD, YYYY')
Time Zones
Datatype Time Zone Fractional Seconds
DATE No No
TIMESTAMP No Yes
TIMESTAMP WITH TIME
ZONE
Explicit Yes
TIMESTAMP WITH LOCAL
TIME ZONE
Relative Yes
Overview of LOB Datatypes
– The LOB datatypes BLOB, CLOB, NCLOB, and BFILE enable you to store and manipulate large blocks
of unstructured data (such as text, graphic images, video clips, and sound waveforms) in binary or
character format.
– LOB datatypes differ from LONG and LONG RAW datatypes in several ways. For example:
 A table can contain multiple LOB columns but only one LONG column.
 A table containing one or more LOB columns can be partitioned, but a table containing a LONG column cannot
be partitioned.
 The maximum size of a LOB is 128 terabytes depending on database block size, and the maximum size of a
LONG is only 2 gigabytes.
 LOBs support random access to data, but LONGs support only sequential access.
 LOB datatypes (except NCLOB) can be attributes of a user-defined object type but LONG datatypes cannot.
 Tables with LOB columns can be replicated, but tables with LONG columns cannot.
Contd
– SQL statements define LOB columns in a table and LOB attributes in a user-defined
object type. When defining LOBs in a table, you can explicitly specify the tablespace
and storage characteristics for each LOB.
– LOB datatypes can be stored inline (within a table), out-of-line (within a tablespace,
using a LOB locator), or in an external file (BFILE datatypes). With compatibility set
to Oracle9i or higher, you can use LOBs with SQL VARCHAR operators and functions.
– This section includes the following topics:
 BLOB Datatype
 CLOB and NCLOB Datatypes
 BFILE Datatype
BLOB Datatype
– The BLOB datatype stores unstructured binary data in the database. BLOBs can
store up to 128 terabytes of binary data.
– BLOBs participate fully in transactions. Changes made to a BLOB value by the
DBMS_LOB package, PL/SQL, or the OCI can be committed or rolled back.
However, BLOB locators cannot span transactions or sessions.
CLOB and NCLOB Datatypes
– The CLOB and NCLOB datatypes store up to 128 terabytes of character data in the
database. CLOBs store database character set data, and NCLOBs store Unicode
national character set data. Storing varying-width LOB data in a fixed-width Unicode
character set internally enables Oracle Database to provide efficient character-
based random access on CLOBs and NCLOBs.
– CLOBs and NCLOBs participate fully in transactions. Changes made to a CLOB or
NCLOB value by the DBMS_LOB package, PL/SQL, or the OCI can be committed or
rolled back. However, CLOB and NCLOB locators cannot span transactions or
sessions. You cannot create an object type with NCLOB attributes, but you can
specify NCLOB parameters in a method for an object type.
BFILE Datatype
– The BFILE datatype stores unstructured binary data in operating-system files
outside the database. A BFILE column or attribute stores a file locator that
points to an external file containing the data. The amount of BFILE data that can
be stored is limited by the operating system.
– BFILEs are read only; you cannot modify them. They support only random (not
sequential) reads, and they do not participate in transactions. The underlying
operating system must maintain the file integrity, security, and durability for
BFILEs. The database administrator must ensure that the file exists and that
Oracle Database processes have operating-system read permissions on the file.
Oracle CREATE TABLE
CREATE TABLE table_name
(
column1 datatype [ NULL | NOT NULL ],
column2 datatype [ NULL | NOT NULL ],
...
column_n datatype [ NULL | NOT NULL ]
);
– table_name: It specifies the name of
the table which you want to create.
– column1, column2, ... column n: It
specifies the columns which you want
to add in the table. Every column must
have a datatype. Every column should
either be defined as "NULL" or "NOT
NULL". In the case, the value is left
blank; it is treated as "NULL" as default.
What is Primary key
– A primary key is a single field or combination of fields that contains a unique
record. It must be filled. None of the field of primary key can contain a null
value. A table can have only one primary key.
– Oracle CREATE TABLE Example with primary key
CREATE TABLE customers
( customer_id number(10) NOT NULL,
customer_name varchar2(50) NOT NULL,
city varchar2(50),
CONSTRAINT customers_pk PRIMARY KEY (customer_id)
);
Oracle ALTER TABLE
Statement
– In Oracle, ALTER TABLE statement specifies how to add, modify, drop or delete
columns in a table. It is also used to rename a table
– How to add column in a table
ALTER TABLE table_name ADD column_name column-definition;
Example:
ALTER TABLE customers ADD customer_age varchar2(50);
– How to modify multiple columns of a table
ALTER TABLE table_name MODIFY (column_1 column_type,
column_2 column_type, ...
column_n column_type);
How to drop column of a table
Syntax
– ALTER TABLE table_name DROP COLUMN column_name;
Example
– ALTER TABLE customers DROP COLUMN customer_name;
How to rename column of a table
Syntax
– ALTER TABLE table_name RENAME COLUMN old_name to new_name;
Example
– ALTER TABLE customers RENAME COLUMN customer_name to cname;
How to rename table
Syntax
– ALTER TABLE table_name RENAME TO new_table_name;
Example
– ALTER TABLE customers RENAME TO retailers;
Continued to Part-2
Thank You

Contenu connexe

Tendances (20)

Database language
Database languageDatabase language
Database language
 
Oracle archi ppt
Oracle archi pptOracle archi ppt
Oracle archi ppt
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
 
Oltp vs olap
Oltp vs olapOltp vs olap
Oltp vs olap
 
The oracle database architecture
The oracle database architectureThe oracle database architecture
The oracle database architecture
 
Database
DatabaseDatabase
Database
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture ppt
 
Oracle
OracleOracle
Oracle
 
Sql fundamentals
Sql fundamentalsSql fundamentals
Sql fundamentals
 
OLAP
OLAPOLAP
OLAP
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
 
DBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCLDBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCL
 
Database Objects
Database ObjectsDatabase Objects
Database Objects
 
Database Management System Introduction
Database Management System IntroductionDatabase Management System Introduction
Database Management System Introduction
 
Data warehousing
Data warehousingData warehousing
Data warehousing
 
Creating Views - oracle database
Creating Views - oracle databaseCreating Views - oracle database
Creating Views - oracle database
 
Rdbms
RdbmsRdbms
Rdbms
 
Ordbms
OrdbmsOrdbms
Ordbms
 
Database Design Slide 1
Database Design Slide 1Database Design Slide 1
Database Design Slide 1
 

Similaire à Oracle (20)

SQL, Oracle, Joins
SQL, Oracle, JoinsSQL, Oracle, Joins
SQL, Oracle, Joins
 
Sql Basics And Advanced
Sql Basics And AdvancedSql Basics And Advanced
Sql Basics And Advanced
 
Plsql quick guide
Plsql quick guidePlsql quick guide
Plsql quick guide
 
Vertica
VerticaVertica
Vertica
 
1650607.ppt
1650607.ppt1650607.ppt
1650607.ppt
 
Sql Server Interview Question
Sql Server Interview QuestionSql Server Interview Question
Sql Server Interview Question
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
MySql
MySqlMySql
MySql
 
2016 02 23_biological_databases_part2
2016 02 23_biological_databases_part22016 02 23_biological_databases_part2
2016 02 23_biological_databases_part2
 
ADBMS Unit-II b
ADBMS Unit-II bADBMS Unit-II b
ADBMS Unit-II b
 
Unit 4 plsql
Unit 4  plsqlUnit 4  plsql
Unit 4 plsql
 
2018 02 20_biological_databases_part2_v_upload
2018 02 20_biological_databases_part2_v_upload2018 02 20_biological_databases_part2_v_upload
2018 02 20_biological_databases_part2_v_upload
 
2017 biological databasespart2
2017 biological databasespart22017 biological databasespart2
2017 biological databasespart2
 
Oracle Introduction
Oracle Introduction Oracle Introduction
Oracle Introduction
 
Dbmsunit v
Dbmsunit vDbmsunit v
Dbmsunit v
 
Database Sizing
Database SizingDatabase Sizing
Database Sizing
 
PO WER - Piotr Mariat - Sql
PO WER - Piotr Mariat - SqlPO WER - Piotr Mariat - Sql
PO WER - Piotr Mariat - Sql
 
unit 1 ppt.pptx
unit 1 ppt.pptxunit 1 ppt.pptx
unit 1 ppt.pptx
 
database.pdf
database.pdfdatabase.pdf
database.pdf
 

Plus de JIGAR MAKHIJA

Php pattern matching
Php pattern matchingPhp pattern matching
Php pattern matchingJIGAR MAKHIJA
 
Php server variables
Php server variablesPhp server variables
Php server variablesJIGAR MAKHIJA
 
Overview on Application protocols in Internet of Things
Overview on Application protocols in Internet of ThingsOverview on Application protocols in Internet of Things
Overview on Application protocols in Internet of ThingsJIGAR MAKHIJA
 
Msp430 g2 with ble(Bluetooth Low Energy)
Msp430 g2 with ble(Bluetooth Low Energy)Msp430 g2 with ble(Bluetooth Low Energy)
Msp430 g2 with ble(Bluetooth Low Energy)JIGAR MAKHIJA
 
Embedded system lab work
Embedded system lab workEmbedded system lab work
Embedded system lab workJIGAR MAKHIJA
 
Presentation on iot- Internet of Things
Presentation on iot- Internet of ThingsPresentation on iot- Internet of Things
Presentation on iot- Internet of ThingsJIGAR MAKHIJA
 
Learn Japanese -Basic kanji 120
Learn Japanese -Basic kanji 120Learn Japanese -Basic kanji 120
Learn Japanese -Basic kanji 120JIGAR MAKHIJA
 
View Alignment Techniques
View Alignment TechniquesView Alignment Techniques
View Alignment TechniquesJIGAR MAKHIJA
 
Letters (complaints & invitations)
Letters (complaints & invitations)Letters (complaints & invitations)
Letters (complaints & invitations)JIGAR MAKHIJA
 
Letter Writing invitation-letter
Letter Writing invitation-letterLetter Writing invitation-letter
Letter Writing invitation-letterJIGAR MAKHIJA
 

Plus de JIGAR MAKHIJA (20)

Php gd library
Php gd libraryPhp gd library
Php gd library
 
Php pattern matching
Php pattern matchingPhp pattern matching
Php pattern matching
 
Php cookies
Php cookiesPhp cookies
Php cookies
 
Php functions
Php functionsPhp functions
Php functions
 
Php sessions
Php sessionsPhp sessions
Php sessions
 
Php server variables
Php server variablesPhp server variables
Php server variables
 
Db function
Db functionDb function
Db function
 
C++ version 1
C++  version 1C++  version 1
C++ version 1
 
C++ Version 2
C++  Version 2C++  Version 2
C++ Version 2
 
SAP Ui5 content
SAP Ui5 contentSAP Ui5 content
SAP Ui5 content
 
Solution doc
Solution docSolution doc
Solution doc
 
Overview on Application protocols in Internet of Things
Overview on Application protocols in Internet of ThingsOverview on Application protocols in Internet of Things
Overview on Application protocols in Internet of Things
 
125 green iot
125 green iot125 green iot
125 green iot
 
Msp430 g2 with ble(Bluetooth Low Energy)
Msp430 g2 with ble(Bluetooth Low Energy)Msp430 g2 with ble(Bluetooth Low Energy)
Msp430 g2 with ble(Bluetooth Low Energy)
 
Embedded system lab work
Embedded system lab workEmbedded system lab work
Embedded system lab work
 
Presentation on iot- Internet of Things
Presentation on iot- Internet of ThingsPresentation on iot- Internet of Things
Presentation on iot- Internet of Things
 
Learn Japanese -Basic kanji 120
Learn Japanese -Basic kanji 120Learn Japanese -Basic kanji 120
Learn Japanese -Basic kanji 120
 
View Alignment Techniques
View Alignment TechniquesView Alignment Techniques
View Alignment Techniques
 
Letters (complaints & invitations)
Letters (complaints & invitations)Letters (complaints & invitations)
Letters (complaints & invitations)
 
Letter Writing invitation-letter
Letter Writing invitation-letterLetter Writing invitation-letter
Letter Writing invitation-letter
 

Dernier

Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Dernier (20)

Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

Oracle

  • 2. What is Oracle – Oracle database is a relational database management system. It is known as Oracle database, Oracle DB or simply Oracle. It is produced and marketed by Oracle Corporation. – Oracle database is the first database designed for enterprise grid computing. The enterprise grid computing provides the most flexible and cost effective way to manage information and applications.
  • 3. Different editions of Oracle database Following are the four editions of the Oracle database. – Enterprise Edition: It is the most robust and secure edition. It offers all features, including superior performance and security. – Standard Edition: It provides the base functionality for users that do not require Enterprise Edition's robust package. – Express Edition (XE): It is the lightweight, free and limited Windows and Linux edition. – Oracle Lite: It is designed for mobile devices
  • 4. Introduction to Oracle Datatypes – Oracle provides the following categories of built-in datatypes: – Overview of Character Datatypes – Overview of Numeric Datatypes – Overview of DATE Datatype – Overview of LOB Datatypes
  • 5. Overview of Character Datatypes – The character datatypes store character (alphanumeric) data in strings, with byte values corresponding to the character encoding scheme, generally called a character set or code page. – The database's character set is established when you create the database. Examples of character sets are 7-bit ASCII (American Standard Code for Information Interchange), EBCDIC (Extended Binary Coded Decimal Interchange Code), Code Page 500, Japan Extended UNIX, and Unicode UTF-8. Oracle supports both single-byte and multibyte encoding schemes.
  • 6. CHAR Datatype – The CHAR datatype stores fixed-length character strings. When you create a table with a CHAR column, you must specify a string length (in bytes or characters) between 1 and 2000 bytes for the CHAR column width. The default is 1 byte. Oracle then guarantees that:  When you insert or update a row in the table, the value for the CHAR column has the fixed length.  If you give a shorter value, then the value is blank-padded to the fixed length.  If a value is too large, Oracle Database returns an error.
  • 7. VARCHAR2 and VARCHAR Datatypes – The VARCHAR2 datatype stores variable-length character strings. When you create a table with a VARCHAR2 column, you specify a maximum string length (in bytes or characters) between 1 and 4000 bytes for the VARCHAR2 column. For each row, Oracle Database stores each value in the column as a variable-length field unless a value exceeds the column's maximum length, in which case Oracle Database returns an error. Using VARCHAR2 and VARCHAR saves on space used by the table. – For example, assume you declare a column VARCHAR2 with a maximum size of 50 characters. In a single-byte character set, if only 10 characters are given for the VARCHAR2 column value in a particular row, the column in the row's row piece stores only the 10 characters (10 bytes), not 50.
  • 8. VARCHAR Datatype – The VARCHAR datatype is synonymous with the VARCHAR2 datatype. To avoid possible changes in behavior, always use the VARCHAR2 datatype to store variable-length character strings.
  • 9. NCHAR and NVARCHAR2 Datatypes – NCHAR and NVARCHAR2 are Unicode datatypes that store Unicode character data. The character set of NCHAR and NVARCHAR2 datatypes can only be either AL16UTF16 or UTF8 and is specified at database creation time as the national character set. AL16UTF16 and UTF8 are both Unicode encoding.  The NCHAR datatype stores fixed-length character strings that correspond to the national character set.  The NVARCHAR2 datatype stores variable length character strings.
  • 10. Contd. NCHAR – The maximum length of an NCHAR column is 2000 bytes. It can hold up to 2000 characters. The actual data is subject to the maximum byte limit of 2000. The two size constraints must be satisfied simultaneously at run time. NVARCHAR2 – The maximum length of an NVARCHAR2 column is 4000 bytes. It can hold up to 4000 characters. The actual data is subject to the maximum byte limit of 4000. The two size constraints must be satisfied simultaneously at run time.
  • 11. LOB Character Datatypes – The LOB datatypes for character data are CLOB and NCLOB. They can store up to 8 terabytes of character data (CLOB) or national character set data (NCLOB). Note: – Do not create tables with LONG columns. Use LOB columns (CLOB, NCLOB) instead. LONG columns are supported only for backward compatibility. – Oracle also recommends that you convert existing LONG columns to LOB columns. LOB columns are subject to far fewer restrictions than LONG columns. Further, LOB functionality is enhanced in every release, whereas LONG functionality has been static for several releases
  • 12. LONG Datatype – Columns defined as LONG can store variable-length character data containing up to 2 gigabytes of information. LONG data is text data that is to be appropriately converted when moving among different systems. – LONG datatype columns are used in the data dictionary to store the text of view definitions. You can use LONG columns in SELECT lists, SET clauses of UPDATE statements, and VALUES clauses of INSERT statements.
  • 13. Overview of Numeric Datatypes – The numeric datatypes store positive and negative fixed and floating-point numbers, zero, infinity, and values that are the undefined result of an operation (that is, is "not a number" or NAN). – This section includes the following topics: – NUMBER Datatype – Floating-Point Numbers
  • 14. NUMBER Datatype – The NUMBER datatype stores fixed and floating-point numbers. Numbers of virtually any magnitude can be stored and are guaranteed portable among different systems operating Oracle Database, up to 38 digits of precision. – For numeric columns, you can specify the column as: – column_name NUMBER – Optionally, you can also specify a precision (total number of digits) and scale (number of digits to the right of the decimal point): – column_name NUMBER (precision, scale)
  • 15. Floating-Point Numbers – Oracle Database provides two numeric datatypes exclusively for floating-point numbers: BINARY_FLOAT and BINARY_DOUBLE. – This section includes the following topics: – BINARY_FLOAT Datatype – BINARY_DOUBLE Datatype
  • 16. Contd BINARY_FLOAT Datatype – BINARY_FLOAT is a 32-bit, single-precision floating-point number datatype. Each BINARY_FLOAT value requires 5 bytes, including a length byte. BINARY_DOUBLE Datatype – BINARY_DOUBLE is a 64-bit, double-precision floating-point number datatype. Each BINARY_DOUBLE value requires 9 bytes, including a length byte.
  • 17. Overview of DATE Datatype – The DATE datatype stores point-in-time values (dates and times) in a table. The DATE datatype stores the year (including the century), the month, the day, the hours, the minutes, and the seconds (after midnight). – For input and output of dates, the standard Oracle date format is DD-MON-YY, as follows:'13-NOV-92' – You can change this default date format for an instance with the parameter NLS_DATE_FORMAT. – TO_DATE ('November 13, 1992', 'MONTH DD, YYYY')
  • 18. Time Zones Datatype Time Zone Fractional Seconds DATE No No TIMESTAMP No Yes TIMESTAMP WITH TIME ZONE Explicit Yes TIMESTAMP WITH LOCAL TIME ZONE Relative Yes
  • 19. Overview of LOB Datatypes – The LOB datatypes BLOB, CLOB, NCLOB, and BFILE enable you to store and manipulate large blocks of unstructured data (such as text, graphic images, video clips, and sound waveforms) in binary or character format. – LOB datatypes differ from LONG and LONG RAW datatypes in several ways. For example:  A table can contain multiple LOB columns but only one LONG column.  A table containing one or more LOB columns can be partitioned, but a table containing a LONG column cannot be partitioned.  The maximum size of a LOB is 128 terabytes depending on database block size, and the maximum size of a LONG is only 2 gigabytes.  LOBs support random access to data, but LONGs support only sequential access.  LOB datatypes (except NCLOB) can be attributes of a user-defined object type but LONG datatypes cannot.  Tables with LOB columns can be replicated, but tables with LONG columns cannot.
  • 20. Contd – SQL statements define LOB columns in a table and LOB attributes in a user-defined object type. When defining LOBs in a table, you can explicitly specify the tablespace and storage characteristics for each LOB. – LOB datatypes can be stored inline (within a table), out-of-line (within a tablespace, using a LOB locator), or in an external file (BFILE datatypes). With compatibility set to Oracle9i or higher, you can use LOBs with SQL VARCHAR operators and functions. – This section includes the following topics:  BLOB Datatype  CLOB and NCLOB Datatypes  BFILE Datatype
  • 21. BLOB Datatype – The BLOB datatype stores unstructured binary data in the database. BLOBs can store up to 128 terabytes of binary data. – BLOBs participate fully in transactions. Changes made to a BLOB value by the DBMS_LOB package, PL/SQL, or the OCI can be committed or rolled back. However, BLOB locators cannot span transactions or sessions.
  • 22. CLOB and NCLOB Datatypes – The CLOB and NCLOB datatypes store up to 128 terabytes of character data in the database. CLOBs store database character set data, and NCLOBs store Unicode national character set data. Storing varying-width LOB data in a fixed-width Unicode character set internally enables Oracle Database to provide efficient character- based random access on CLOBs and NCLOBs. – CLOBs and NCLOBs participate fully in transactions. Changes made to a CLOB or NCLOB value by the DBMS_LOB package, PL/SQL, or the OCI can be committed or rolled back. However, CLOB and NCLOB locators cannot span transactions or sessions. You cannot create an object type with NCLOB attributes, but you can specify NCLOB parameters in a method for an object type.
  • 23. BFILE Datatype – The BFILE datatype stores unstructured binary data in operating-system files outside the database. A BFILE column or attribute stores a file locator that points to an external file containing the data. The amount of BFILE data that can be stored is limited by the operating system. – BFILEs are read only; you cannot modify them. They support only random (not sequential) reads, and they do not participate in transactions. The underlying operating system must maintain the file integrity, security, and durability for BFILEs. The database administrator must ensure that the file exists and that Oracle Database processes have operating-system read permissions on the file.
  • 24. Oracle CREATE TABLE CREATE TABLE table_name ( column1 datatype [ NULL | NOT NULL ], column2 datatype [ NULL | NOT NULL ], ... column_n datatype [ NULL | NOT NULL ] ); – table_name: It specifies the name of the table which you want to create. – column1, column2, ... column n: It specifies the columns which you want to add in the table. Every column must have a datatype. Every column should either be defined as "NULL" or "NOT NULL". In the case, the value is left blank; it is treated as "NULL" as default.
  • 25. What is Primary key – A primary key is a single field or combination of fields that contains a unique record. It must be filled. None of the field of primary key can contain a null value. A table can have only one primary key. – Oracle CREATE TABLE Example with primary key CREATE TABLE customers ( customer_id number(10) NOT NULL, customer_name varchar2(50) NOT NULL, city varchar2(50), CONSTRAINT customers_pk PRIMARY KEY (customer_id) );
  • 26. Oracle ALTER TABLE Statement – In Oracle, ALTER TABLE statement specifies how to add, modify, drop or delete columns in a table. It is also used to rename a table – How to add column in a table ALTER TABLE table_name ADD column_name column-definition; Example: ALTER TABLE customers ADD customer_age varchar2(50); – How to modify multiple columns of a table ALTER TABLE table_name MODIFY (column_1 column_type, column_2 column_type, ... column_n column_type);
  • 27. How to drop column of a table Syntax – ALTER TABLE table_name DROP COLUMN column_name; Example – ALTER TABLE customers DROP COLUMN customer_name;
  • 28. How to rename column of a table Syntax – ALTER TABLE table_name RENAME COLUMN old_name to new_name; Example – ALTER TABLE customers RENAME COLUMN customer_name to cname;
  • 29. How to rename table Syntax – ALTER TABLE table_name RENAME TO new_table_name; Example – ALTER TABLE customers RENAME TO retailers;