{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

chPL_SQLPart1

chPL_SQLPart1 - IntroductiontoPL/SQL IS620 1 Roadmap n n n...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Introduction to PL/SQL IS 620 Advanced Database Projects
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Roadmap n Motivation for PL/SQL n Anonymous vs. named PL/SQL subprogram n Basic PL/SQL features:  n Basic structure n Variables and Assignment n Control structures (if then, loop) n Using SQL in PL/SQL n Insert, update, delete n Implicit cursor (select) n Explicit cursor (select)
Image of page 2
3 Is SQL Powerful Enough? n Do you need to write multiple SQL statements for a task? n E.g.,  to  transfer  a  certain  amount  from  your  checking  account  to  saving,  only  transfer  when  there  is  enough  balance in checking. n Does SQL have variables, loops, if then else …? n How can others use the SQL statements you developed?
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Why PL/SQL n Real life example: E.g., a credit bureau provides a credit  scoring service.  n The  company  collects  personal  financial  data  from  credit  card  companies, banks, …., and store the data in a database n Customers can ask the credit score of some person n The score is computed from the data using a complex formula (a  top commercial secret) n Can we just use SQL? What's my  credit score 700!
Image of page 4
5 Why PL/SQL n Solution 1: embed SQL into a  procedure language such as JAVA or C n E.g., JDBC, ODBC n Client program sends SQL to DB server and gets back intermediate results n Client program then computes credit score n Problems? What's my  credit score 700! SQL Intermediate  results JAVA program
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6 Why PL/SQL n Oracle Procedure Language/SQL  n SQL + procedure language features such as variables, IF…THEN, loop,   function or procedure, etc. n A named PL/SQL program is stored within the database, and can be used  by other users n Benefits n Communication cost n Portability n Security n Learning curve What's my credit score? Call a PL/SQL function  on database server 700!
Image of page 6
7 Why PL/SQL n Oracle Procedure Language/SQL  n Downside? n Which DMBS to use? n Does PL/SQL provide a GUI? What's my credit score? Call a PL/SQL function  on database server 700!
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
8 Roadmap n Motivation for PL/SQL n Anonymous vs. named PL/SQL subprogram n Basic PL/SQL features:  n Basic structure n Variables and Assignment n Control structures (if then, loop) n Using SQL in PL/SQL n Insert, update, delete n Implicit cursor (select) n Explicit cursor (select)
Image of page 8
9 Anonymous PL/SQL Programs n Program has no name n Code is NOT stored in database (discarded after  execution) n Code can be stored as a script file in local file  system, but you have to manually save & load it.
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern