SlideShare a Scribd company logo
1 of 11
1 Using ORACLE® MANIPULATING DATA using PL/SQL
2 COMMENTING CODE We can add comments to the PL/SQL .There are two types of comments: EXAMPLE: 	DECLARE eage 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 FUNCTIONS The 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); BEGIN SELECT name INTO ename FROM InfoTable WHERE phone = TO_NUMBER(mainphone); END
4 Operators in PL/SQL
5 Operators EXAMPLES: profit BOOL;	sp NUMBER;	cp NUMBER; BEGIN cp:= 1000; sp:= 1200; profit := ((sp – cp) > 100);      -- finding if profit was above 100 or not END
6 RETRIEVING 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_name WHERE { expression….}; EXAMPLE: DECLARE eage NUMBER; 		BEGIN 		SELECT age INTO eage FROM InfoTable WHERE name = ‘bill’; 	DBMS_OUTPUT.PUT_LINE(‘ Age of bill is : ‘ || eage); 		END
7 INSERT command We 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 UPDATE command We can update data in tables using the PL/SQL UPDATE comand. SYNTAX: UPDATE table_name SET 	column = value,  	(…column = value); WHERE	{expression }; EXAMPLE:	DECLARE eage NUMBER(5):=40; 		BEGIN 		UPDATE InfoTable SET age = eage 		WHERE name =  ‘micheal’; 		END
9 DELETE command We can delete data from tables using the PL/SQL DELETE comand. SYNTAX: DELETE  FROM table_name WHERE  { expression }; EXAMPLE: BEGIN 		DELETE  FROM InfoTable 		WHERE  age = 45 ; 		END
10 MERGE COMMAND The 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. DECLARE ename INFOTABLE.NAME%TYPE := ‘bill'; BEGIN 	MERGE INTO addtable a      	USING infotable I					Infotable      	ON (i.name =ename)				    	WHEN MATCHED THEN      	UPDATE SET a.phone = i.phoneADDtable    	WHEN NOT MATCHED THEN      	INSERT VALUES(i.name,NULL,i.phone);		 END; ADDtable after MERGE
THANK YOU 11 THANK YOU FOR VIEWING THIS PRESENTATION FOR MORE PRESENTATIONS AND VIDEOS ON ORACLE AND DATAMINING , please visit:   www.dataminingtools.net

More Related Content

What's hot (11)

Trigger and cursor program using sql
Trigger and cursor program using sqlTrigger and cursor program using sql
Trigger and cursor program using sql
 
Les11
Les11Les11
Les11
 
Belajar Menghindari SQL Injection dengan Simulasi
Belajar Menghindari SQL Injection dengan SimulasiBelajar Menghindari SQL Injection dengan Simulasi
Belajar Menghindari SQL Injection dengan Simulasi
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql Syntax
 
Duplicaterows
DuplicaterowsDuplicaterows
Duplicaterows
 
Les02
Les02Les02
Les02
 
Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries
 
Les03
Les03Les03
Les03
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Les09
Les09Les09
Les09
 
Les13
Les13Les13
Les13
 

Viewers also liked

Ireland Apo University Fy 10 Tibbs Slideshare
Ireland Apo University Fy 10 Tibbs SlideshareIreland Apo University Fy 10 Tibbs Slideshare
Ireland Apo University Fy 10 Tibbs Slideshare
Tibbs Pereira
 
HistoriografíA Latina LatíN Ii
HistoriografíA Latina LatíN IiHistoriografíA Latina LatíN Ii
HistoriografíA Latina LatíN Ii
lara
 

Viewers also liked (20)

Erika
ErikaErika
Erika
 
Interacting with Oracle Database
Interacting with Oracle DatabaseInteracting with Oracle Database
Interacting with Oracle Database
 
Test
TestTest
Test
 
Paramount Search Partners
Paramount Search PartnersParamount Search Partners
Paramount Search Partners
 
DataKraft - Powerful No-Coding Platform for Business Applications
DataKraft - Powerful No-Coding Platform for Business ApplicationsDataKraft - Powerful No-Coding Platform for Business Applications
DataKraft - Powerful No-Coding Platform for Business Applications
 
Facebook: An Innovative Influenza Pandemic Early Warning System
Facebook: An Innovative Influenza Pandemic Early Warning SystemFacebook: An Innovative Influenza Pandemic Early Warning System
Facebook: An Innovative Influenza Pandemic Early Warning System
 
Control Statements in Matlab
Control Statements in  MatlabControl Statements in  Matlab
Control Statements in Matlab
 
Festivals Refuerzo
Festivals RefuerzoFestivals Refuerzo
Festivals Refuerzo
 
LISP: Scope and extent in lisp
LISP: Scope and extent in lispLISP: Scope and extent in lisp
LISP: Scope and extent in lisp
 
Data-Applied: Technology Insights
Data-Applied: Technology InsightsData-Applied: Technology Insights
Data-Applied: Technology Insights
 
Oracle: Joins
Oracle: JoinsOracle: Joins
Oracle: Joins
 
Excel Datamining Addin Intermediate
Excel Datamining Addin IntermediateExcel Datamining Addin Intermediate
Excel Datamining Addin Intermediate
 
Ireland Apo University Fy 10 Tibbs Slideshare
Ireland Apo University Fy 10 Tibbs SlideshareIreland Apo University Fy 10 Tibbs Slideshare
Ireland Apo University Fy 10 Tibbs Slideshare
 
LISP: Errors In Lisp
LISP: Errors In LispLISP: Errors In Lisp
LISP: Errors In Lisp
 
MED dra Coding -MSSO
MED dra Coding -MSSOMED dra Coding -MSSO
MED dra Coding -MSSO
 
Probability And Its Axioms
Probability And Its AxiomsProbability And Its Axioms
Probability And Its Axioms
 
Research Presentation
Research PresentationResearch Presentation
Research Presentation
 
Quick Look At Clustering
Quick Look At ClusteringQuick Look At Clustering
Quick Look At Clustering
 
MS SQL SERVER: Programming sql server data mining
MS SQL SERVER: Programming sql server data miningMS SQL SERVER: Programming sql server data mining
MS SQL SERVER: Programming sql server data mining
 
HistoriografíA Latina LatíN Ii
HistoriografíA Latina LatíN IiHistoriografíA Latina LatíN Ii
HistoriografíA Latina LatíN Ii
 

Similar to Oracle: PLSQL Commands

Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
Belle Wx
 
e computer notes - Producing readable output with i sql plus
e computer notes - Producing readable output with i sql pluse computer notes - Producing readable output with i sql plus
e computer notes - Producing readable output with i sql plus
ecomputernotes
 
Exploring collections with example
Exploring collections with exampleExploring collections with example
Exploring collections with example
pranav kumar verma
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
Alessandro Baratella
 

Similar to Oracle: PLSQL Commands (20)

Plsql
PlsqlPlsql
Plsql
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03
 
Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01
 
Les18[1]Interacting with the Oracle Server
Les18[1]Interacting with  the Oracle ServerLes18[1]Interacting with  the Oracle Server
Les18[1]Interacting with the Oracle Server
 
PL-SQL.pdf
PL-SQL.pdfPL-SQL.pdf
PL-SQL.pdf
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
 
Select To Order By
Select  To  Order BySelect  To  Order By
Select To Order By
 
My SQL.pptx
My SQL.pptxMy SQL.pptx
My SQL.pptx
 
Oracle Training in Kochi | Trivandrum |Thrissur
Oracle Training in Kochi | Trivandrum |ThrissurOracle Training in Kochi | Trivandrum |Thrissur
Oracle Training in Kochi | Trivandrum |Thrissur
 
e computer notes - Producing readable output with i sql plus
e computer notes - Producing readable output with i sql pluse computer notes - Producing readable output with i sql plus
e computer notes - Producing readable output with i sql plus
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Exploring collections with example
Exploring collections with exampleExploring collections with example
Exploring collections with example
 
Oracle : DML
Oracle : DMLOracle : DML
Oracle : DML
 
Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05Oracle - Program with PL/SQL - Lession 05
Oracle - Program with PL/SQL - Lession 05
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
Basic sqlstatements
Basic sqlstatementsBasic sqlstatements
Basic sqlstatements
 
02 Writing Executable Statments
02 Writing Executable Statments02 Writing Executable Statments
02 Writing Executable Statments
 
Oracle: Commands
Oracle: CommandsOracle: Commands
Oracle: Commands
 
Oracle: DDL
Oracle: DDLOracle: DDL
Oracle: DDL
 

More from DataminingTools Inc

More from DataminingTools Inc (20)

Terminology Machine Learning
Terminology Machine LearningTerminology Machine Learning
Terminology Machine Learning
 
Techniques Machine Learning
Techniques Machine LearningTechniques Machine Learning
Techniques Machine Learning
 
Machine learning Introduction
Machine learning IntroductionMachine learning Introduction
Machine learning Introduction
 
Areas of machine leanring
Areas of machine leanringAreas of machine leanring
Areas of machine leanring
 
AI: Planning and AI
AI: Planning and AIAI: Planning and AI
AI: Planning and AI
 
AI: Logic in AI 2
AI: Logic in AI 2AI: Logic in AI 2
AI: Logic in AI 2
 
AI: Logic in AI
AI: Logic in AIAI: Logic in AI
AI: Logic in AI
 
AI: Learning in AI 2
AI: Learning in AI 2AI: Learning in AI 2
AI: Learning in AI 2
 
AI: Learning in AI
AI: Learning in AI AI: Learning in AI
AI: Learning in AI
 
AI: Introduction to artificial intelligence
AI: Introduction to artificial intelligenceAI: Introduction to artificial intelligence
AI: Introduction to artificial intelligence
 
AI: Belief Networks
AI: Belief NetworksAI: Belief Networks
AI: Belief Networks
 
AI: AI & Searching
AI: AI & SearchingAI: AI & Searching
AI: AI & Searching
 
AI: AI & Problem Solving
AI: AI & Problem SolvingAI: AI & Problem Solving
AI: AI & Problem Solving
 
Data Mining: Text and web mining
Data Mining: Text and web miningData Mining: Text and web mining
Data Mining: Text and web mining
 
Data Mining: Outlier analysis
Data Mining: Outlier analysisData Mining: Outlier analysis
Data Mining: Outlier analysis
 
Data Mining: Mining stream time series and sequence data
Data Mining: Mining stream time series and sequence dataData Mining: Mining stream time series and sequence data
Data Mining: Mining stream time series and sequence data
 
Data Mining: Mining ,associations, and correlations
Data Mining: Mining ,associations, and correlationsData Mining: Mining ,associations, and correlations
Data Mining: Mining ,associations, and correlations
 
Data Mining: Graph mining and social network analysis
Data Mining: Graph mining and social network analysisData Mining: Graph mining and social network analysis
Data Mining: Graph mining and social network analysis
 
Data warehouse and olap technology
Data warehouse and olap technologyData warehouse and olap technology
Data warehouse and olap technology
 
Data Mining: Data processing
Data Mining: Data processingData Mining: Data processing
Data Mining: Data processing
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Oracle: PLSQL Commands

  • 1. 1 Using ORACLE® MANIPULATING DATA using PL/SQL
  • 2. 2 COMMENTING CODE We can add comments to the PL/SQL .There are two types of comments: EXAMPLE: DECLARE eage 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. 3 FUNCTIONS The 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); BEGIN SELECT name INTO ename FROM InfoTable WHERE phone = TO_NUMBER(mainphone); END
  • 4. 4 Operators in PL/SQL
  • 5. 5 Operators EXAMPLES: profit BOOL; sp NUMBER; cp NUMBER; BEGIN cp:= 1000; sp:= 1200; profit := ((sp – cp) > 100); -- finding if profit was above 100 or not END
  • 6. 6 RETRIEVING 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_name WHERE { expression….}; EXAMPLE: DECLARE eage NUMBER; BEGIN SELECT age INTO eage FROM InfoTable WHERE name = ‘bill’; DBMS_OUTPUT.PUT_LINE(‘ Age of bill is : ‘ || eage); END
  • 7. 7 INSERT command We 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. 8 UPDATE command We can update data in tables using the PL/SQL UPDATE comand. SYNTAX: UPDATE table_name SET column = value, (…column = value); WHERE {expression }; EXAMPLE: DECLARE eage NUMBER(5):=40; BEGIN UPDATE InfoTable SET age = eage WHERE name = ‘micheal’; END
  • 9. 9 DELETE command We can delete data from tables using the PL/SQL DELETE comand. SYNTAX: DELETE FROM table_name WHERE { expression }; EXAMPLE: BEGIN DELETE FROM InfoTable WHERE age = 45 ; END
  • 10. 10 MERGE COMMAND The 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. DECLARE ename INFOTABLE.NAME%TYPE := ‘bill'; BEGIN MERGE INTO addtable a USING infotable I Infotable ON (i.name =ename) WHEN MATCHED THEN UPDATE SET a.phone = i.phoneADDtable WHEN NOT MATCHED THEN INSERT VALUES(i.name,NULL,i.phone); END; ADDtable after MERGE
  • 11. THANK YOU 11 THANK YOU FOR VIEWING THIS PRESENTATION FOR MORE PRESENTATIONS AND VIDEOS ON ORACLE AND DATAMINING , please visit: www.dataminingtools.net