SlideShare a Scribd company logo
1 of 13
DB2 Objects
and
SQL-PL
Presented by Mr. Fuangwith S.
2
Agenda
• Data Type
• Buffer Pool
• Tablespaces
• Table
• SQL-PL
• SYSCAT
• Schema
• Procedure
IBM DB2 9.1 Fundamental Presentation
DB2 Objects and SQL-PL presented by Fuangwith S.
3
Agenda (Cont.)
• Function
• View
• Trigger
IBM DB2 9.1 Fundamental Presentation
DB2 Objects and SQL-PL presented by Fuangwith S.
4
DB2’s Data Type
IBM DB2 9.1 Fundamental Presentation
DB2 Objects and SQL-PL presented by Fuangwith S.
5
Interesting Data Type
IBM DB2 9.1 Fundamental Presentation
Data Type Min Max
CHARACTER 1 255
VARCHAR 1 32704
SMALLINT -32768 +32767
INTEGER or INT -2147483648 +2147483647
BIGINT -9223372036854775808 +9223372036854775807
DECIMAL or NUMERIC 1 - 10³¹ 10³¹ - 1
DATE 0001-01-01 12/31/9999
TIME 00.00.00 24.00.00
TIMESTAMP 0001-01-01-00.00.00.000000 9999-12-31-24.00.00.000000
DB2 Objects and SQL-PL presented by Fuangwith S.
6
Tablespaces and Buffer Pools
IBM DB2 9.1 Fundamental Presentation
DB2 Objects and SQL-PL presented by Fuangwith S.
7
LAB I
• Create Buffer Pools
• Create Tablespaces
• Create Table
• Drop Table
• Alter Table
IBM DB2 9.1 Fundamental Presentation
DB2 Objects and SQL-PL presented by Fuangwith S.
8
SQL-PL
IBM DB2 9.1
SQL-PL
PL/SQL r a
IBM DB2 9.1 Fundamental Presentation
IBM DB2 9.7
SQL-PL
PL/SQL a
a
DB2 Objects and SQL-PL presented by Fuangwith S.
9
System Catalog
IBM DB2 9.1 Fundamental Presentation
• Schema SYSCAT
• example
– SYSCAT.TABLES
– SYSCAT.TABLESPACES
– SYSCAT.COLUMNS
– SYSCAT.VIEWS
– and etc.
SQL0407N Assignment of a NULL value to a NOT NULL column
"TBSPACEID=3, TABLEID=27, COLNO=3" is not allowed. SQLSTATE=23502
DB2 Objects and SQL-PL presented by Fuangwith S.
10
SQL - 407
IBM DB2 9.1 Fundamental Presentation
SELECT
TBS.TBSPACE,
TAB.TABNAME,
COL.COLNAME
FROM
SYSCAT.TABLESPACES AS TBS
INNER JOIN SYSCAT.TABLES AS TAB
ON TBS.TBSPACEID =
TAB.TBSPACEID
INNER JOIN SYSCAT.COLUMNS AS COL
ON TAB.TABNAME = COL.TABNAME
WHERE
TBS.TBSPACEID = 3
AND TAB.TABLEID = 27
AND COL.COLNO = 3;
DB2 Objects and SQL-PL presented by Fuangwith S.
11
LAB II
• Create Stored Procedure
• Drop Stored Procedure
IBM DB2 9.1 Fundamental Presentation
DB2 Objects and SQL-PL presented by Fuangwith S.
12
LAB III
• Function
• View
• Trigger
IBM DB2 9.1 Fundamental Presentation
DB2 Objects and SQL-PL presented by Fuangwith S.
13
TOMORROW
IBM DB2 9.1 Fundamental Presentation
• Global Temporary Table (GTT)
• Catch Exception
• Signal
• ‘LIKE’ predicate
• Basic Locking
DB2 Objects and SQL-PL presented by Fuangwith S.

More Related Content

Similar to DB2 Objects and SQL-PL

Les10[1]Creating and Managing Tables
Les10[1]Creating and Managing TablesLes10[1]Creating and Managing Tables
Les10[1]Creating and Managing Tablessiavosh kaviani
 
SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10Umair Amjad
 
SQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptxSQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptxKashifManzoorMeo
 
DBMS_ddlVFSBFSBS22222222222222222222222222222222222
DBMS_ddlVFSBFSBS22222222222222222222222222222222222DBMS_ddlVFSBFSBS22222222222222222222222222222222222
DBMS_ddlVFSBFSBS22222222222222222222222222222222222227567
 
Oracle vs. SQL Server- War of the Indices
Oracle vs. SQL Server- War of the IndicesOracle vs. SQL Server- War of the Indices
Oracle vs. SQL Server- War of the IndicesKellyn Pot'Vin-Gorman
 
OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...
OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...
OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...Altinity Ltd
 
MDI Training DB2 Course
MDI Training DB2 CourseMDI Training DB2 Course
MDI Training DB2 CourseMarcus Davage
 
Doxxy: Document and Report generation for Oracle made easy
Doxxy: Document and Report generation for Oracle made easyDoxxy: Document and Report generation for Oracle made easy
Doxxy: Document and Report generation for Oracle made easyJan Huyzentruyt
 
What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?ukdpe
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewEric Nelson
 
SQl-1.pptx
SQl-1.pptxSQl-1.pptx
SQl-1.pptxkingVox
 
Public Training SQL Implementation & Embedded Programming in IBM i (05-09 Jun...
Public Training SQL Implementation & Embedded Programming in IBM i (05-09 Jun...Public Training SQL Implementation & Embedded Programming in IBM i (05-09 Jun...
Public Training SQL Implementation & Embedded Programming in IBM i (05-09 Jun...Hany Paulina
 
Public Training SQL Implementation & Embedded Programming in IBM i
Public Training SQL Implementation & Embedded Programming in IBM iPublic Training SQL Implementation & Embedded Programming in IBM i
Public Training SQL Implementation & Embedded Programming in IBM iHany Paulina
 
Database_Tuning.ppt
Database_Tuning.pptDatabase_Tuning.ppt
Database_Tuning.pptAsimEisa2
 

Similar to DB2 Objects and SQL-PL (20)

Ibm db2
Ibm db2Ibm db2
Ibm db2
 
Les10[1]Creating and Managing Tables
Les10[1]Creating and Managing TablesLes10[1]Creating and Managing Tables
Les10[1]Creating and Managing Tables
 
SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10
 
SQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptxSQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptx
 
Mysql rab2-student
Mysql rab2-studentMysql rab2-student
Mysql rab2-student
 
Mysql rab2-student
Mysql rab2-studentMysql rab2-student
Mysql rab2-student
 
DBMS_ddlVFSBFSBS22222222222222222222222222222222222
DBMS_ddlVFSBFSBS22222222222222222222222222222222222DBMS_ddlVFSBFSBS22222222222222222222222222222222222
DBMS_ddlVFSBFSBS22222222222222222222222222222222222
 
Oracle vs. SQL Server- War of the Indices
Oracle vs. SQL Server- War of the IndicesOracle vs. SQL Server- War of the Indices
Oracle vs. SQL Server- War of the Indices
 
SQL Tuning 101
SQL Tuning 101SQL Tuning 101
SQL Tuning 101
 
sqltuning101-170419021007-2.pdf
sqltuning101-170419021007-2.pdfsqltuning101-170419021007-2.pdf
sqltuning101-170419021007-2.pdf
 
OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...
OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...
OSA Con 2022 - Apache Iceberg_ An Architectural Look Under the Covers - Alex ...
 
MDI Training DB2 Course
MDI Training DB2 CourseMDI Training DB2 Course
MDI Training DB2 Course
 
Doxxy: Document and Report generation for Oracle made easy
Doxxy: Document and Report generation for Oracle made easyDoxxy: Document and Report generation for Oracle made easy
Doxxy: Document and Report generation for Oracle made easy
 
Sql Server 2000
Sql Server 2000Sql Server 2000
Sql Server 2000
 
What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
SQl-1.pptx
SQl-1.pptxSQl-1.pptx
SQl-1.pptx
 
Public Training SQL Implementation & Embedded Programming in IBM i (05-09 Jun...
Public Training SQL Implementation & Embedded Programming in IBM i (05-09 Jun...Public Training SQL Implementation & Embedded Programming in IBM i (05-09 Jun...
Public Training SQL Implementation & Embedded Programming in IBM i (05-09 Jun...
 
Public Training SQL Implementation & Embedded Programming in IBM i
Public Training SQL Implementation & Embedded Programming in IBM iPublic Training SQL Implementation & Embedded Programming in IBM i
Public Training SQL Implementation & Embedded Programming in IBM i
 
Database_Tuning.ppt
Database_Tuning.pptDatabase_Tuning.ppt
Database_Tuning.ppt
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 

Recently uploaded (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 

DB2 Objects and SQL-PL

  • 2. 2 Agenda • Data Type • Buffer Pool • Tablespaces • Table • SQL-PL • SYSCAT • Schema • Procedure IBM DB2 9.1 Fundamental Presentation DB2 Objects and SQL-PL presented by Fuangwith S.
  • 3. 3 Agenda (Cont.) • Function • View • Trigger IBM DB2 9.1 Fundamental Presentation DB2 Objects and SQL-PL presented by Fuangwith S.
  • 4. 4 DB2’s Data Type IBM DB2 9.1 Fundamental Presentation DB2 Objects and SQL-PL presented by Fuangwith S.
  • 5. 5 Interesting Data Type IBM DB2 9.1 Fundamental Presentation Data Type Min Max CHARACTER 1 255 VARCHAR 1 32704 SMALLINT -32768 +32767 INTEGER or INT -2147483648 +2147483647 BIGINT -9223372036854775808 +9223372036854775807 DECIMAL or NUMERIC 1 - 10³¹ 10³¹ - 1 DATE 0001-01-01 12/31/9999 TIME 00.00.00 24.00.00 TIMESTAMP 0001-01-01-00.00.00.000000 9999-12-31-24.00.00.000000 DB2 Objects and SQL-PL presented by Fuangwith S.
  • 6. 6 Tablespaces and Buffer Pools IBM DB2 9.1 Fundamental Presentation DB2 Objects and SQL-PL presented by Fuangwith S.
  • 7. 7 LAB I • Create Buffer Pools • Create Tablespaces • Create Table • Drop Table • Alter Table IBM DB2 9.1 Fundamental Presentation DB2 Objects and SQL-PL presented by Fuangwith S.
  • 8. 8 SQL-PL IBM DB2 9.1 SQL-PL PL/SQL r a IBM DB2 9.1 Fundamental Presentation IBM DB2 9.7 SQL-PL PL/SQL a a DB2 Objects and SQL-PL presented by Fuangwith S.
  • 9. 9 System Catalog IBM DB2 9.1 Fundamental Presentation • Schema SYSCAT • example – SYSCAT.TABLES – SYSCAT.TABLESPACES – SYSCAT.COLUMNS – SYSCAT.VIEWS – and etc. SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=3, TABLEID=27, COLNO=3" is not allowed. SQLSTATE=23502 DB2 Objects and SQL-PL presented by Fuangwith S.
  • 10. 10 SQL - 407 IBM DB2 9.1 Fundamental Presentation SELECT TBS.TBSPACE, TAB.TABNAME, COL.COLNAME FROM SYSCAT.TABLESPACES AS TBS INNER JOIN SYSCAT.TABLES AS TAB ON TBS.TBSPACEID = TAB.TBSPACEID INNER JOIN SYSCAT.COLUMNS AS COL ON TAB.TABNAME = COL.TABNAME WHERE TBS.TBSPACEID = 3 AND TAB.TABLEID = 27 AND COL.COLNO = 3; DB2 Objects and SQL-PL presented by Fuangwith S.
  • 11. 11 LAB II • Create Stored Procedure • Drop Stored Procedure IBM DB2 9.1 Fundamental Presentation DB2 Objects and SQL-PL presented by Fuangwith S.
  • 12. 12 LAB III • Function • View • Trigger IBM DB2 9.1 Fundamental Presentation DB2 Objects and SQL-PL presented by Fuangwith S.
  • 13. 13 TOMORROW IBM DB2 9.1 Fundamental Presentation • Global Temporary Table (GTT) • Catch Exception • Signal • ‘LIKE’ predicate • Basic Locking DB2 Objects and SQL-PL presented by Fuangwith S.