Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

PLSQL Basics For JDBC

Loading...

Published in: PL/SQL
1,306 Views

This PPT contains all the basic knowledge that we need to have in order to learn JDBC programming in Java.

Alok / Mumbai

8 years of teaching experience

Qualification: B.Tech/B.E. (RGPV, Bhopal - 2014)

Teaches: Computer, IT, CSS Training, HTML Training, Web Designing, Web Development, MBA Entrance, C / C++, C# (C Sharp), Java And J2EE, Visual Basic, Android Training, AJAX Training, Java Script

Contact this Tutor
  1. PL/SQL PRESENTATION BY ALOK GUPTA Basics for JDBC Programming
  2. What is PL/SQL? combination of syntaxes of a programming language and SQL Co mands. Whatever can be done i C, C++ and in SQL can be combined in PLSQL. PRESENTATION BY ALOK GUPTA Drawbacks of SQL SQL is a command based language, due to which we can only run predefined commands, we cannot run our own logic, like loops, 'If else, we cannot make arrays. PL/SQL can do his.
  3. Basic Structure of a PL/SQL code: e only need to have oracle SQL installed to run PL/SQL programs. Code structure: All variable declarations are done here. begin: PRESENTATION BY ALOK GUPTA All executable code goes here. exception: All error handling goes here. end;
  4. IMPORTANT POINTS ABOUT PL/SQL 1. 2. 3. 4. 5. BEGIN and END are required, declaration and exception blocks are not mandatory. l/' runs a PL/SQL cod in SQL Client. PL/SQL is a non-case sensiti e language. Syntax of variable declaration is opppsite to what is in C/C+ +/Java, there we do: PRESENTATION BY ALOK GUPTA int a; -5 Declaring a variable of int type in other languages. In PL/SQL we write opposite : a int; -5 Declaring a variable of int type in PL/SQL. It supports all data types(all SQL data types are supported: archar, number, date, blob) It also gives its own data types like int, float -5 subtypes ofnumber. Boolean data types are also available. % type and % rowtype are also available. These are main data types.
  5. IMPORTANT POINTS ABOUT PL/SQL(continued...) 6. If you want t how output using PL/SQL (not in Java) then we use: Where DBMS_OUTPUT a package and PUT_LINE a procedure. 7. To take input, we use & operator. Iti called Substitutor. PRESENTATION BY ALOK GUPTA 8. Operators: := Assignment = Comparision AND, OR etc... will work here as they work in SQL. operator is used to calculate power. In SQL is u want to calculate power, we use power(2,3). But in PL/SQL u can also use 2**3.
  6. IMPORTANT POINTS ABOUT PL/SQL(continued...) 9. When r running PL/SQLcode, you will need to run below command: SET SERVEROUTPUT ON; By doing this DBMS_OUTPUT.PUT_LINE(); will start working, otherwise it will put output of this function will be written in a buffer and then you will need to print content of buffer to see the o t ut. So it is better to execute this statement per session. PRESENTATION BY ALOK GUPTA Next we will see some example codes.
  7. Code Sample 1 SET SERVEROUTPUT ON; BEGIN END; Output: Welcome Code Sample 2 DECLARE: a int; BEGIN: PRESENTATION BY ALOK GUPTA of a END; Output: Value of a is 10
  8. Code 3: DECLARE: a int; BEGIN: a:=&a; This can be an name, not necessaril same as variable name. ente ed ' Il a); END; Output: Enter value for a:15 You entered 15. PRESENTATION BY ALOK GUPTA
  9. Code 4: WAP to accept 2 numbers from user and print their sum on screen as output. DECLARE: a int; b int; c int; BEGIN: a:=&firstnum; b:=&secondnum; c:=a+b; PRESENTATION BY ALOK GUPTA are 'Il a Il and ' Il b); sum ' Il c); END; Output: Enter value for firstnum : 10 Enter value for secondnum : 20 Numbers are 10 and 20 Their sum is 30. NOTE : gives a new line automatically, if u don't want use only DBMS_OUTPUT.P TO
  10. Syntax of "IF" If test co d then End if; Syntax of "if else" If test cond then Else PRESENTATION BY ALOK GUPTA End if; Syntax of "if elsif" If test cond then Elsif test cond then Else Endif;
  11. Code 4: WAP to take an number from user and tell if it is even or odd. DECLARE' a int; BEGIN: a:=&number; if mod(a,2) = 0 then Number even'); Else PRESENTATION BY ALOK GUPTA ddl); Endif; End; Output: Enter value for number : 2 Number is even.
  12. All these codes are called anonymous codes. To call these from Java we need to create Stored procedures or functions. We will learn that in ext class. PRESENTATION BY ALOK GUPTA