SlideShare a Scribd company logo
1Using ORACLE®MANIPULATING DATA using PL/SQL
2COMMENTING CODEWe can add comments to the PL/SQL .There are two types of comments:EXAMPLE:	DECLAREeage NUMBER ;	       --This is a single line comment . number variable defined.	BEGIN	SELECT age INTO eage FROM InfoTable WHERE name = ‘bill’;	/* A multiline 			command .Here the select command is defined */	END
3FUNCTIONSThe functions available in SQL can be used in PL/SQL code. Not all SQL function can be used in PL/SQL statements .The SQL functions unavailable in Pl/SQL statements are:DECODE function.All GROUP functions except the LEAST and GREATEST.EXAMPLE1:ename  VARCHAR2(20) := INITCAP(‘bill’); 	--stores Bill in the variable ename.We can use data type conversion function in PL/SQL statements.EXAMPLE 2:mainphone NUMBER(10) := 9000000000;ename VARCHAR2(20);BEGINSELECT name INTO ename FROM InfoTable WHERE phone = TO_NUMBER(mainphone);END
4Operators in PL/SQL
5OperatorsEXAMPLES:profit BOOL;	sp NUMBER;	cp NUMBER;BEGINcp:= 1000;sp:= 1200;profit := ((sp – cp) > 100);      -- finding if profit was above 100 or notEND
6RETRIEVING DATA We can retrieve data using the SELECT command. Variables are used to store the values returned from the SELECT statement and hence have to be of the same datatype and be declared before use.SYNTAX:SELECT column, […column] INTO  variable_name,[…variable_name]FROM table_nameWHERE { expression….};EXAMPLE:DECLAREeage NUMBER;		BEGIN		SELECT age INTO eage FROM InfoTable WHERE name = ‘bill’;	DBMS_OUTPUT.PUT_LINE(‘ Age of bill is : ‘ || eage);		END
7INSERT commandWe can insert data into tables using the PL/SQL INSERT command.SYNTAX:INSERT INTO table_name(column , (…..column))VALUES(value , (…..value));EXAMPLE:BEGIN		INSERT INTO InfoTable		(name,age,phone)		VALUES		(‘micheal’,45,9666002203);		END
8UPDATE commandWe can update data in tables using the PL/SQL UPDATE comand.SYNTAX:UPDATE table_nameSET 	column = value, 	(…column = value);WHERE	{expression };EXAMPLE:	DECLAREeage NUMBER(5):=40;		BEGIN		UPDATE InfoTable SET age = eage		WHERE name =  ‘micheal’;		END
9DELETE commandWe can delete data from tables using the PL/SQL DELETE comand.SYNTAX:DELETE  FROM table_nameWHERE  { expression };EXAMPLE:BEGIN		DELETE  FROM InfoTable		WHERE  age = 45 ;		END
10MERGE COMMANDThe MERGE comand is use to merge the data of one table into the data of another table.The merge command updates or inserts rows in order to make data in both rows similar.DECLAREename INFOTABLE.NAME%TYPE := ‘bill';BEGIN	MERGE INTO addtable a     	USING infotable I					Infotable     	ON (i.name =ename)				   	WHEN MATCHED THEN     	UPDATE SETa.phone = i.phoneADDtable   	WHEN NOT MATCHED THEN     	INSERT VALUES(i.name,NULL,i.phone);		END;ADDtable after MERGE
THANK YOU11THANK YOU FOR VIEWING THIS PRESENTATIONFOR MORE PRESENTATIONS AND VIDEOS ON ORACLE AND DATAMINING ,please visit:  www.dataminingtools.net

More Related Content

What's hot (18)

PPT
Les10
arnold 7490
 
PPT
Les09
arnold 7490
 
ODP
My sql Syntax
Reka
 
ODP
Prabu's sql quries
Prabu Cse
 
PPTX
DDL,DML,SQL Functions and Joins
Ashwin Dinoriya
 
PDF
Database Systems - SQL - DDL Statements (Chapter 3/2)
Vidyasagar Mundroy
 
PPSX
Oracle Training in Kochi | Trivandrum |Thrissur
IndiaOptions Softwares
 
PDF
Data Definition Language (DDL)
Mohd Tousif
 
PPT
Les12
arnold 7490
 
PPT
Mysql Ppt
Hema Prasanth
 
PPTX
Creating database using sql commands
Belle Wx
 
PDF
SQL Quick Reference Card
Techcanvass
 
PPT
Les14
arnold 7490
 
PPTX
Commands of DML in SQL
Ashish Gaurkhede
 
DOC
Oracle sql material
prathap kumar
 
PDF
Learn plsql
Iulian Avram
 
PPTX
SQL - DML and DDL Commands
Shrija Madhu
 
PPT
Les02
Sudharsan S
 
My sql Syntax
Reka
 
Prabu's sql quries
Prabu Cse
 
DDL,DML,SQL Functions and Joins
Ashwin Dinoriya
 
Database Systems - SQL - DDL Statements (Chapter 3/2)
Vidyasagar Mundroy
 
Oracle Training in Kochi | Trivandrum |Thrissur
IndiaOptions Softwares
 
Data Definition Language (DDL)
Mohd Tousif
 
Mysql Ppt
Hema Prasanth
 
Creating database using sql commands
Belle Wx
 
SQL Quick Reference Card
Techcanvass
 
Commands of DML in SQL
Ashish Gaurkhede
 
Oracle sql material
prathap kumar
 
Learn plsql
Iulian Avram
 
SQL - DML and DDL Commands
Shrija Madhu
 

Viewers also liked (16)

PDF
بطاقة وصف تسويق
Asma Al-khaldi
 
PDF
Vitaminas Crescer Com SaúDe
Medusa Fabula
 
PPT
강호동유재석
Webometrics Class
 
PPTX
Projecto Jornalismo
guestf8ccf75
 
PPTX
Derric social media-tactics-gmc
Vasil Azarov
 
PPTX
market strategy
Antony Mazumder
 
PDF
الوصف الوظيفي لوظيفة خدمة العملاء
ثامر عبدالله
 
PPTX
사이버컴과 네트워크분석 6주차 1
Han Woo PARK
 
PPT
Benchmarking tqm
Deborah Sharon
 
PDF
Ayurvedic Treatment For Premature Ejaculation To Increase Sex Duration
Ayush Remedies
 
PPSX
DECEMBER 2016 - Pictures of the month - Dec.̣16 - Dec.21
vinhbinh2010
 
PDF
Learning Deep Learning
simaokasonse
 
PPT
Customer Equity
Yodhia Antariksa
 
PPT
Strategic Planning For Managers
Yodhia Antariksa
 
PDF
تمرانست
Nour Elbader
 
PPT
New Product Development Strategy
Yodhia Antariksa
 
بطاقة وصف تسويق
Asma Al-khaldi
 
Vitaminas Crescer Com SaúDe
Medusa Fabula
 
강호동유재석
Webometrics Class
 
Projecto Jornalismo
guestf8ccf75
 
Derric social media-tactics-gmc
Vasil Azarov
 
market strategy
Antony Mazumder
 
الوصف الوظيفي لوظيفة خدمة العملاء
ثامر عبدالله
 
사이버컴과 네트워크분석 6주차 1
Han Woo PARK
 
Benchmarking tqm
Deborah Sharon
 
Ayurvedic Treatment For Premature Ejaculation To Increase Sex Duration
Ayush Remedies
 
DECEMBER 2016 - Pictures of the month - Dec.̣16 - Dec.21
vinhbinh2010
 
Learning Deep Learning
simaokasonse
 
Customer Equity
Yodhia Antariksa
 
Strategic Planning For Managers
Yodhia Antariksa
 
تمرانست
Nour Elbader
 
New Product Development Strategy
Yodhia Antariksa
 
Ad

Similar to Oracle: Programs (20)

PPTX
4. plsql
Amrit Kaur
 
PPTX
Oracle: PLSQL Introduction
oracle content
 
PDF
PLSQL Note
Arun Sial
 
DOCX
Oracle Fundamental and PL-SQL.docx
Chandan Kumar
 
PPTX
Ch as pbdasdadssadsadsadasdasdasdas fdt .pptx
sharmilasatishpore
 
PPTX
pl/sql online Training|sql online Training | iTeknowledge
Masood Khan
 
PDF
PL-SQL.pdf
Anas Nakash
 
PDF
Database management system chapter5
Pranab Dasgupta
 
PDF
Pl sql student guide v 1
Nexus
 
PPTX
ORACLE PL/SQL
ASHABOOPATHY
 
PPT
Ppt on plssql study aboutnsmsmskskwkwkwkwk
DrStrange634619
 
PDF
plsql notes.pdf for students Oracle databases
azkacade16
 
PDF
lab14444444444444444444444444444444444444444
227567
 
PPTX
PLSQL Tutorial
Quang Minh Đoàn
 
PPTX
Introduction to SQL, SQL*Plus
Chhom Karath
 
PDF
PL_SQL
Nirod Baran
 
PPT
10gplsqlslide-120704232925-phJKKJJKKJpapp01.ppt
Noorien3
 
PPT
Les18[1]Interacting with the Oracle Server
siavosh kaviani
 
PDF
plsql_tutorial.pdf
norbertonorberto5
 
PDF
PLSQL tutorial...
JYOTI RANJAN PAL
 
4. plsql
Amrit Kaur
 
Oracle: PLSQL Introduction
oracle content
 
PLSQL Note
Arun Sial
 
Oracle Fundamental and PL-SQL.docx
Chandan Kumar
 
Ch as pbdasdadssadsadsadasdasdasdas fdt .pptx
sharmilasatishpore
 
pl/sql online Training|sql online Training | iTeknowledge
Masood Khan
 
PL-SQL.pdf
Anas Nakash
 
Database management system chapter5
Pranab Dasgupta
 
Pl sql student guide v 1
Nexus
 
ORACLE PL/SQL
ASHABOOPATHY
 
Ppt on plssql study aboutnsmsmskskwkwkwkwk
DrStrange634619
 
plsql notes.pdf for students Oracle databases
azkacade16
 
lab14444444444444444444444444444444444444444
227567
 
PLSQL Tutorial
Quang Minh Đoàn
 
Introduction to SQL, SQL*Plus
Chhom Karath
 
PL_SQL
Nirod Baran
 
10gplsqlslide-120704232925-phJKKJJKKJpapp01.ppt
Noorien3
 
Les18[1]Interacting with the Oracle Server
siavosh kaviani
 
plsql_tutorial.pdf
norbertonorberto5
 
PLSQL tutorial...
JYOTI RANJAN PAL
 
Ad

More from oracle content (12)

PPTX
Oracle: Procedures
oracle content
 
PPTX
Oracle : DML
oracle content
 
PPTX
Oracle: Commands
oracle content
 
PPTX
Oracle: Joins
oracle content
 
PPTX
Oracle:Cursors
oracle content
 
PPTX
Oracle: Control Structures
oracle content
 
PPTX
Oracle: Dw Design
oracle content
 
PPTX
Oracle: Basic SQL
oracle content
 
PPTX
Oracle Warehouse
oracle content
 
PPTX
Oracle: Functions
oracle content
 
PPT
Oracle: New Plsql
oracle content
 
PPTX
Oracle: Fundamental Of Dw
oracle content
 
Oracle: Procedures
oracle content
 
Oracle : DML
oracle content
 
Oracle: Commands
oracle content
 
Oracle: Joins
oracle content
 
Oracle:Cursors
oracle content
 
Oracle: Control Structures
oracle content
 
Oracle: Dw Design
oracle content
 
Oracle: Basic SQL
oracle content
 
Oracle Warehouse
oracle content
 
Oracle: Functions
oracle content
 
Oracle: New Plsql
oracle content
 
Oracle: Fundamental Of Dw
oracle content
 

Recently uploaded (20)

PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Digital Circuits, important subject in CS
contactparinay1
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 

Oracle: Programs

  • 2. 2COMMENTING CODEWe can add comments to the PL/SQL .There are two types of comments:EXAMPLE: DECLAREeage NUMBER ; --This is a single line comment . number variable defined. BEGIN SELECT age INTO eage FROM InfoTable WHERE name = ‘bill’; /* A multiline command .Here the select command is defined */ END
  • 3. 3FUNCTIONSThe functions available in SQL can be used in PL/SQL code. Not all SQL function can be used in PL/SQL statements .The SQL functions unavailable in Pl/SQL statements are:DECODE function.All GROUP functions except the LEAST and GREATEST.EXAMPLE1:ename VARCHAR2(20) := INITCAP(‘bill’); --stores Bill in the variable ename.We can use data type conversion function in PL/SQL statements.EXAMPLE 2:mainphone NUMBER(10) := 9000000000;ename VARCHAR2(20);BEGINSELECT name INTO ename FROM InfoTable WHERE phone = TO_NUMBER(mainphone);END
  • 5. 5OperatorsEXAMPLES:profit BOOL; sp NUMBER; cp NUMBER;BEGINcp:= 1000;sp:= 1200;profit := ((sp – cp) > 100); -- finding if profit was above 100 or notEND
  • 6. 6RETRIEVING DATA We can retrieve data using the SELECT command. Variables are used to store the values returned from the SELECT statement and hence have to be of the same datatype and be declared before use.SYNTAX:SELECT column, […column] INTO variable_name,[…variable_name]FROM table_nameWHERE { expression….};EXAMPLE:DECLAREeage NUMBER; BEGIN SELECT age INTO eage FROM InfoTable WHERE name = ‘bill’; DBMS_OUTPUT.PUT_LINE(‘ Age of bill is : ‘ || eage); END
  • 7. 7INSERT commandWe can insert data into tables using the PL/SQL INSERT command.SYNTAX:INSERT INTO table_name(column , (…..column))VALUES(value , (…..value));EXAMPLE:BEGIN INSERT INTO InfoTable (name,age,phone) VALUES (‘micheal’,45,9666002203); END
  • 8. 8UPDATE commandWe can update data in tables using the PL/SQL UPDATE comand.SYNTAX:UPDATE table_nameSET column = value, (…column = value);WHERE {expression };EXAMPLE: DECLAREeage NUMBER(5):=40; BEGIN UPDATE InfoTable SET age = eage WHERE name = ‘micheal’; END
  • 9. 9DELETE commandWe can delete data from tables using the PL/SQL DELETE comand.SYNTAX:DELETE FROM table_nameWHERE { expression };EXAMPLE:BEGIN DELETE FROM InfoTable WHERE age = 45 ; END
  • 10. 10MERGE COMMANDThe MERGE comand is use to merge the data of one table into the data of another table.The merge command updates or inserts rows in order to make data in both rows similar.DECLAREename INFOTABLE.NAME%TYPE := ‘bill';BEGIN MERGE INTO addtable a USING infotable I Infotable ON (i.name =ename) WHEN MATCHED THEN UPDATE SETa.phone = i.phoneADDtable WHEN NOT MATCHED THEN INSERT VALUES(i.name,NULL,i.phone); END;ADDtable after MERGE
  • 11. THANK YOU11THANK YOU FOR VIEWING THIS PRESENTATIONFOR MORE PRESENTATIONS AND VIDEOS ON ORACLE AND DATAMINING ,please visit: www.dataminingtools.net