1. Difference between function procedure and package..
A function or procedure or an anonymous block is nothing but, SQL and PL/SQL statements are used to perform a task such that it would return a value or values to the calling environment. (this s a generic definition for function and procedure)
And coming to their difference just remember the below points which they would expect
Functions:
1. Function return a single value.
2. Functions can be used only in SQL statements.
Procedure:
1. Procedure can return multiple values.
2. Procedures cannot be used inside SQL statements.
Package: Its a collection of Functions, procedures, variables, Pl/SQL tables, types, etc into it. A package consists of Package body and Package specification. Main advantage of package is it supports OOPS concepts like overloading and encapsulation.
2. Can we define a procedure in package body without declaring it in package specification.
Yes we can. It is a concept of encapsulation. We can use those procedures inside the package and cannot be used outside the package. Those procedures are called as private procedures
3. What is an exception
4. Name few predefined exceptions.
5. What are the datatypes a available in PL/SQL?
Scalar: NUMBER, VARCHAR2, DATE, CHAR, LONG, BOOLEAN.
Composite: RECORD & TABLE.
6. How many columns can be created in a table
7. What is a cursor and what are the types of Cursors?
There are two types of cursors: Implict Cursor and Explicit Cursor.
Implict Cursors are the SQL queries which retries data and stores virtually as cursor
User defined cursors are called Explicit Cursors. They can be declared and defined.
No comments:
Post a Comment