51) Can we define exceptions twice in same block?
52) What is the difference between a procedure and a function?
Functions return a single variable by value whereas procedures do not return any variable by value. Rather they return multiple variables by passing variables by reference through their OUT parameter.
53) Can you have two functions with the same name in a PL/SQL block?
54) Can you have two stored functions with the same name?
55) Can you call a stored function in the constraint of a table?
56) What are the various types of parameter modes in a procedure?
IN, OUTAND INOUT.
57) Can some body give me some example of INSTEAD OF trigger?
INSTEAD-OF triggers provide a transparent way of modifying views that cannot be modified directly through SQL DML statements (INSERT, UPDATE, and DELETE). These triggers are called INSTEAD-OF triggers because, unlike other types of triggers,
Oracle fires the trigger instead of executing the triggering statement.
CREATE TABLE dept (deptno NUMBER PRIMARY KEY,
CREATE TABLE emp (empno NUMBER PRIMARY KEY,
deptno NUMBER REFERENCES dept(deptno),
CREATE VIEW manager_info AS
SELECT d.deptno, d.deptname, e.empno,
FROM emp e, dept d
WHERE e.empno = d.manager_num;
CREATE TRIGGER manager_info_insert
INSTEAD OF INSERT ON manager_info
REFERENCING NEW AS n — new manager information
FOR EACH ROW
/* First check to make sure that the number of employees
in the department is greater than one */
SELECT COUNT(*) INTO empCount
FROM emp e
WHERE e.deptno = :n.deptno;
/* If there are enough employees then make him or her the
IF empCount >= 1 THEN
UPDATE dept d
SET manager_num = :n.empno
WHERE d.deptno = :n.deptno;
58) How can I get the source code for a function or a procedure or a package from the database?
Query the view ALL_SOURCE. It has a field called TYPE, which says whether the object is a FUNCTION or a PACKAGE or a PACKAGE BODY or a PROCEDURE.
The field TEXT gives the actual source code for that object.
SELECT TEXT FROM ALL_SOURCE WHERE
59) What is Over Loading and what are its restrictions?
Over loading means an object performing different functions depending upon the no. of parameters or the data type of the parameters passed to it.
60) Can functions be over loaded?
61) Can 2 functions have same name & input parameters but differ only by Return data type
62) Are the constructs of a procedure, function or a package?
The constructs of a procedure, function or a package are: variables and constants, cursors, exceptions
63) Why create or Replace and not drop and recreate procedures?
So that Grants are not dropped.
64) Can you pass parameters in packages? How?
Yes. You can pass parameters to procedures or functions in a package.
65) What are the parts of a database trigger?
The parts of a trigger are:
A triggering event or statement
A trigger restriction
A trigger action
66) What is the advantage of a stored procedure over a database trigger?
We have control over the firing of a stored procedure but we have no control over the firing of a trigger.
67) What is the maximum no. of statements that can be specified in a trigger statement ?
68) Can views be specified in a trigger statement?
69) What are the values of :new and :old in Insert/Delete/Update Triggers ?
INSERT: new = new value, old = NULL
DELETE: new = NULL, old = old value
UPDATE: new = new value, old = old value
70) What are cascading triggers? What is the maximum no of cascading triggers at a time?
When a statement in a trigger body causes another trigger to be fired, the triggers are said to be cascading. Max = 32.
71) What are mutating triggers?
A trigger giving a SELECT on the table on which the trigger is written.
72) What are constraining triggers?
A trigger giving an Insert/Updat e on a table having referential integrity constraint on the triggering table.
73) Describe Oracle database’s physical and logical structure ?
Physical: Data files, Redo Log files, Control file.
Logical: Tables, Views, Table spaces, etc.
74) Can you increase the size of a table space? How?
Yes, by adding data files to it.
75) What is the use of Control files?
Contains pointers to locations of various data files, redo log files, etc.
76) What is the use of Data Dictionary?
Used by Oracle to store information about various physical and logical Oracle structures e.g. Tables, Table spaces, data files, etc
77) What are the advantages of clusters?
Access time reduced for joins.
78) What are the disadvantages of clusters?
The time for Insert increases.
79) Can Long/Long RAW be clustered?
81) Can null keys be entered in cluster index, normal index?
82) Can Check constraint be used for self referential integrity? How?
Yes. In the CHECK condition for a column of a table, we can reference some other column of the same table and thus enforce self-referential integrity.
83) What are the min. extents allocated to a rollback extent?
84) What are the states of a rollback segment? What is the difference between partly available and needs recovery?
The various states of a rollback segment are:
ONLINE, OFFLINE, PARTLY AVAILABLE, NEEDS RECOVERY and INVALID.
85) What is the difference between unique key and primary key?
Unique key can be null; Primary key cannot be null.
86) An insert statement followed by a create table statement followed by rollback? Will the rows be inserted?
87) Can you define multiple save points?
88) Can you Rollback to any save points?
89) What is the maximum no. of columns a table can have ?
90) Can you pass a parameter to a cursor?
Explicit cursors can take parameters, as the example below shows. A cursor parameter can appear in a query wherever a constant can appear.
CURSOR c1 (median IN NUMBER) IS
SELECT job, ename FROM emp WHERE sal > median;
91) What is the significance of the &, and && operators in PL SQL?
The & operator means that the PL SQL block requires user input for a variable.
The&& operator means that the value of this variable should be the same as inputted by the user previously for this same variable.
91) What are the various types of RollBack Segments?
Public Available to all instances
Private Available to specific instance
92) Can you use %row count as a parameter to a cursor?
93) Is the query below allowed :
Select sal, ename Into x From emp Where ename = ‘KING’
(Where x is a record of Number(4) and Char(15))
94) Is the assignment given below allowed :
ABC = PQR (Where ABC and PQR are records)
95) Is this for loop allowed :
For x in &Start..&End Loop
96) How many rows will the following SQL return :
Select * from emp Where rownum < 10;
97) How many rows will the following SQL return :
Select * from emp Where rownum = 10;
98) Which symbol preceeds the path to the table in the remote database?
99) Are views automatically updated when base tables are updated?
100) Can a trigger written for a view?