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 (11)

RTF
Trigger and cursor program using sql
Sushil Mishra
 
PPT
Les11
arnold 7490
 
PDF
Belajar Menghindari SQL Injection dengan Simulasi
Rio Astamal
 
ODP
My sql Syntax
Reka
 
PDF
Duplicaterows
oracle documents
 
PPT
Les02
arnold 7490
 
ODP
Prabu's sql quries
Prabu Cse
 
PPT
Les03
arnold 7490
 
ODP
Mysqlppt
Reka
 
PPT
Les09
arnold 7490
 
PPT
Les13
arnold 7490
 
Trigger and cursor program using sql
Sushil Mishra
 
Belajar Menghindari SQL Injection dengan Simulasi
Rio Astamal
 
My sql Syntax
Reka
 
Duplicaterows
oracle documents
 
Prabu's sql quries
Prabu Cse
 
Mysqlppt
Reka
 

Viewers also liked (20)

PPTX
Interacting with Oracle Database
Chhom Karath
 
XLSX
Test
spencer shanks
 
PPT
Paramount Search Partners
jjmcdermott
 
PPTX
DataKraft - Powerful No-Coding Platform for Business Applications
Tibbs Pereira
 
PPT
Facebook: An Innovative Influenza Pandemic Early Warning System
Chen Luo
 
PPTX
Control Statements in Matlab
DataminingTools Inc
 
PPT
Festivals Refuerzo
guest9536ef5
 
PPTX
LISP: Scope and extent in lisp
DataminingTools Inc
 
PPTX
Data-Applied: Technology Insights
DataminingTools Inc
 
PPTX
Oracle: Joins
DataminingTools Inc
 
PPT
Excel Datamining Addin Intermediate
DataminingTools Inc
 
PPTX
Ireland Apo University Fy 10 Tibbs Slideshare
Tibbs Pereira
 
PPTX
LISP: Errors In Lisp
DataminingTools Inc
 
PPTX
MED dra Coding -MSSO
drabhishekpitti
 
PPTX
Probability And Its Axioms
DataminingTools Inc
 
PPT
Research Presentation
guest136b28e
 
PPTX
Quick Look At Clustering
DataminingTools Inc
 
PPTX
MS SQL SERVER: Programming sql server data mining
DataminingTools Inc
 
PPT
HistoriografíA Latina LatíN Ii
lara
 
Interacting with Oracle Database
Chhom Karath
 
Paramount Search Partners
jjmcdermott
 
DataKraft - Powerful No-Coding Platform for Business Applications
Tibbs Pereira
 
Facebook: An Innovative Influenza Pandemic Early Warning System
Chen Luo
 
Control Statements in Matlab
DataminingTools Inc
 
Festivals Refuerzo
guest9536ef5
 
LISP: Scope and extent in lisp
DataminingTools Inc
 
Data-Applied: Technology Insights
DataminingTools Inc
 
Oracle: Joins
DataminingTools Inc
 
Excel Datamining Addin Intermediate
DataminingTools Inc
 
Ireland Apo University Fy 10 Tibbs Slideshare
Tibbs Pereira
 
LISP: Errors In Lisp
DataminingTools Inc
 
MED dra Coding -MSSO
drabhishekpitti
 
Probability And Its Axioms
DataminingTools Inc
 
Research Presentation
guest136b28e
 
Quick Look At Clustering
DataminingTools Inc
 
MS SQL SERVER: Programming sql server data mining
DataminingTools Inc
 
HistoriografíA Latina LatíN Ii
lara
 
Ad

Similar to Oracle: PLSQL Commands (20)

PPT
Plsql
Mandeep Singh
 
PPT
Les18[1]Interacting with the Oracle Server
siavosh kaviani
 
PDF
PL-SQL.pdf
Anas Nakash
 
PPTX
Creating database using sql commands
Belle Wx
 
PPT
Select To Order By
Krizia Capacio
 
PDF
full detailled SQL notesquestion bank (1).pdf
yvpachorib23
 
PPTX
My SQL.pptx
KieveBarreto1
 
PPSX
Oracle Training in Kochi | Trivandrum |Thrissur
IndiaOptions Softwares
 
PPT
e computer notes - Producing readable output with i sql plus
ecomputernotes
 
PDF
Database Management System
Hitesh Mohapatra
 
DOCX
Exploring collections with example
pranav kumar verma
 
PPTX
Oracle : DML
oracle content
 
PDF
Database development coding standards
Alessandro Baratella
 
PDF
Basic sqlstatements
Anjac
 
PPT
02 Writing Executable Statments
rehaniltifat
 
PPTX
Oracle: DDL
DataminingTools Inc
 
PPTX
Oracle: Commands
oracle content
 
PPTX
8. sql
khoahuy82
 
PPTX
Function in PL/SQL
Pooja Dixit
 
ODP
Open Gurukul Language PL/SQL
Open Gurukul
 
Les18[1]Interacting with the Oracle Server
siavosh kaviani
 
PL-SQL.pdf
Anas Nakash
 
Creating database using sql commands
Belle Wx
 
Select To Order By
Krizia Capacio
 
full detailled SQL notesquestion bank (1).pdf
yvpachorib23
 
My SQL.pptx
KieveBarreto1
 
Oracle Training in Kochi | Trivandrum |Thrissur
IndiaOptions Softwares
 
e computer notes - Producing readable output with i sql plus
ecomputernotes
 
Database Management System
Hitesh Mohapatra
 
Exploring collections with example
pranav kumar verma
 
Oracle : DML
oracle content
 
Database development coding standards
Alessandro Baratella
 
Basic sqlstatements
Anjac
 
02 Writing Executable Statments
rehaniltifat
 
Oracle: DDL
DataminingTools Inc
 
Oracle: Commands
oracle content
 
8. sql
khoahuy82
 
Function in PL/SQL
Pooja Dixit
 
Open Gurukul Language PL/SQL
Open Gurukul
 
Ad

More from DataminingTools Inc (20)

PPTX
Terminology Machine Learning
DataminingTools Inc
 
PPTX
Techniques Machine Learning
DataminingTools Inc
 
PPTX
Machine learning Introduction
DataminingTools Inc
 
PPTX
Areas of machine leanring
DataminingTools Inc
 
PPTX
AI: Planning and AI
DataminingTools Inc
 
PPTX
AI: Logic in AI 2
DataminingTools Inc
 
PPTX
AI: Logic in AI
DataminingTools Inc
 
PPTX
AI: Learning in AI 2
DataminingTools Inc
 
PPTX
AI: Learning in AI
DataminingTools Inc
 
PPTX
AI: Introduction to artificial intelligence
DataminingTools Inc
 
PPTX
AI: Belief Networks
DataminingTools Inc
 
PPTX
AI: AI & Searching
DataminingTools Inc
 
PPTX
AI: AI & Problem Solving
DataminingTools Inc
 
PPTX
Data Mining: Text and web mining
DataminingTools Inc
 
PPTX
Data Mining: Outlier analysis
DataminingTools Inc
 
PPTX
Data Mining: Mining stream time series and sequence data
DataminingTools Inc
 
PPTX
Data Mining: Mining ,associations, and correlations
DataminingTools Inc
 
PPTX
Data Mining: Graph mining and social network analysis
DataminingTools Inc
 
PPTX
Data warehouse and olap technology
DataminingTools Inc
 
PPTX
Data Mining: Data processing
DataminingTools Inc
 
Terminology Machine Learning
DataminingTools Inc
 
Techniques Machine Learning
DataminingTools Inc
 
Machine learning Introduction
DataminingTools Inc
 
Areas of machine leanring
DataminingTools Inc
 
AI: Planning and AI
DataminingTools Inc
 
AI: Logic in AI 2
DataminingTools Inc
 
AI: Logic in AI
DataminingTools Inc
 
AI: Learning in AI 2
DataminingTools Inc
 
AI: Learning in AI
DataminingTools Inc
 
AI: Introduction to artificial intelligence
DataminingTools Inc
 
AI: Belief Networks
DataminingTools Inc
 
AI: AI & Searching
DataminingTools Inc
 
AI: AI & Problem Solving
DataminingTools Inc
 
Data Mining: Text and web mining
DataminingTools Inc
 
Data Mining: Outlier analysis
DataminingTools Inc
 
Data Mining: Mining stream time series and sequence data
DataminingTools Inc
 
Data Mining: Mining ,associations, and correlations
DataminingTools Inc
 
Data Mining: Graph mining and social network analysis
DataminingTools Inc
 
Data warehouse and olap technology
DataminingTools Inc
 
Data Mining: Data processing
DataminingTools Inc
 

Recently uploaded (20)

PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
July Patch Tuesday
Ivanti
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
July Patch Tuesday
Ivanti
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 

Oracle: PLSQL Commands

  • 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