Sie sind auf Seite 1von 3

1. What is difference between a PROCEDURE & FUNCTION ?

A Function always returns a value using the return statement.


A Procedure may return one or more values through parameters or may not return at all.

A function can be called from sql statements and queries while procedure can be called in a begin end
block only.

2. State the difference between implicit and explicit cursor's.


Implict cursor can be used to handle single record (i.e) the select query used should not yield more than
one row.
if u have handle more than one record then Explict cursor should be used.

3. Explian rowid,rownum?What are the pseduocolumns we have?


ROWID - Hexa decimal number each and every row having unique.
ROWNUM - It is a integer number also unique for sorting Normally TOP N Analysys.
Psudo Column are NEXTVAL, CURRVAL, SYSDATE etc.

4. Explain the usage of WHERE CURRENT OF clause in cursors ?

5. How we can create a table in PL/SQL block. insert records into it??? is it possible by some procedure or
function?? please give example...

6. What is difference between stored procedures and application procedures,stored function and application
function?
Stored Procedure/Function is a compiled database object, which is used for fast response from Oracle
Engine.Difference is Stored Procedure must return multiple value and function must return single value .

7. State the advantage and disadvantage of Cursor?


Advantage :
In pl/sql if you want perform some actions more than one records you should user these cursors only. bye
using these cursors you process the query records. you can easily move the records and you can exit from
procedure when you required by using cursor attributes.

Disadvantage:
using implicit/explicit cursors are depended by sutiation. if the result set is les than 50 or 100 records it is
better to go for implicit cursors. if the result set is large then you should use exlicit cursors. other wise it
will put burdon on cpu.

8. What is Raise_application_error ?
Raise_application_error is a procedure of package DBMS which allows to issue user_defined error
message.

9. Name the tables where characteristics of Package, procedure and functions are stored ?
These Data Base objects are stored in data dictionary. Which can be accessed by Data dict. views like
(dba_user/DBA_objects/source).

10. What will the Output for this Coding? Declare Cursor c1 is select * from emp FORUPDATE; Z c1%rowtype;
Begin Open C1; Fetch c1 into Z; Commit; Fetch c1 in to Z; end;

11. Explain how procedures and functions are called in a PL/SQL block ?
Function is called as part of an expression.
procedure is called as a PL/SQL statement

12. What is the starting "oracle error number"? 2)What is meant by forward declaration in functions?
ora 00001

13. What is pl/sql?what are the advantages of pl/sql?


Pl/sql is a procedural language.
Pl/sql block structure language it must be contain three block declare, begin, end.

Plot No: 235, Sai Cyber Hills, Survey Of India Layout, Khanamet, Madhapur,
Hyderabad - 500033
Ph: +91- 40 - 42617425/6/7
www.graymatterinformatics.com
We can handle error in plsql using exception.
Pl/sql is a portable. We can use any application so save the time and we can reuse the code in any
application.

14. What is trigger, cursor, functions in pl-sql and we need sample programs about it?
Trigger is an event driven PL/SQL block. Event may be any DML transaction.

Cursor is a stored select statement for that current session. It will not be stored in the database, it is a
logical component.

Function is a set of PL/SQL statements or a PL/SQL block, which performs an operation and must return a
value.

15. How many types of database triggers can be specified on a table ? What are they ?
Data base triggers are mainly two types only they are
1) Statement level triggers
2) Row level triggers

16. What is ref cursor?


In PL/SQL ,pointer has a datatype REF X where REF-Reference. Its is similar like a pointers.

17. How to debug the procedure ?


DBMS_OUTPUT oracle supplied package is used to debug the Procedure.

18. Can Commit,Rollback ,Savepoint be used in Database Triggers?If yes than HOW? If no Why?With Reasons
We can not do commit,rollback and savepoints in triggers. But there is an exception for Autonomous
triggers. In autonomous triggers we can commit in between. To make a normal trigger to autonomous
trigger you have to put the below statement.

PRAGMA AUTONOMOUS_TRANSACTION;

19. How to disable multiple triggers of a table at at a time?


alter table<table name> disable all trigger

20. In pl/sql functions what is use of out parameter even though we have return statement.

21. What is a database trigger ? Name some usages of database trigger ?

A database triggers is stored PL/SQL program unit associated with a specific database table or view. The
code in the trigger defines the action the database needs to perform whenever some database
manipulation (INSERT, UPDATE, DELETE) takes place.

22. What are two parts of package ?


1) Package specification
2) Package body

23. In a Distributed Database System Can we execute two queries simultaneously ? Justify ?
As Distributed database system based on 2 phase commit, one query is independent of 2 nd query so of
course we can run.

24. What is difference between % ROWTYPE and TYPE RECORD ?


% ROWTYPE is to be used whenever query returns a entire row of a table or view.
TYPE rec RECORD is to be used whenever query returns columns of different
table or views and variables.

25. Is it possible to use Transaction control Statements such a ROLLBACK or COMMIT in Database Trigger ?
Why ?

26. How we can create a table through procedure ?

Plot No: 235, Sai Cyber Hills, Survey Of India Layout, Khanamet, Madhapur,
Hyderabad - 500033
Ph: +91- 40 - 42617425/6/7
www.graymatterinformatics.com
We can create table by using procedure using execute immediate command.
create procedure p1 is
begin
EXECUTE IMMEDIATE 'CREATE TABLE temp AS
SELECT * FROM emp ' ;
END;

27. What is difference between a Cursor declared in a procedure and Cursor declared in a package
specification ?
A cursor declared in a package specification is global and can be accessed by other procedures or
procedures in a package.
A cursor declared in a procedure is local to the procedure that can not be accessed by other procedures.

28. What is Pragma EXECPTION_INIT ? Explain the usage ?

29. What are the modes of parameters that can be passed to a procedure ?

30. What is PL/SQL table ?


Objects of type TABLE are called "PL/SQL tables", which are modeled as (but not the same as) database
tables, PL/SQL tables use a primary PL/SQL tables can have one column and a primary key.

31. Give the structure of the function ?


FUNCTION name (argument list .....) Return datatype is
local variable declarations
Begin
executable statements
Exception
execution handlers
End;

32. What is TTITLE and BTITLE?


This Ttitle and Btitle are used on creating SQL*PLUS report. Ttitle is used for toptitle heading where as
Btitle is used for Buttomn title heading.

33. Give the structure of the procedure ?


PROCEDURE name (parameter list.....)
is
local variable declarations
BEGIN
Executable statements.
Exception.
exception handlers
end;

34. What happens if a procedure that updates a column of table X is called in a database trigger of the same
table ?

35. What are the components of a PL/SQL Block ?


Declarative part, Executable part and Exception part.
Datatypes PL/SQL
Declare
variable declaration
Begin
Execution part
Exception
Exception handling
End;

Plot No: 235, Sai Cyber Hills, Survey Of India Layout, Khanamet, Madhapur,
Hyderabad - 500033
Ph: +91- 40 - 42617425/6/7
www.graymatterinformatics.com

Das könnte Ihnen auch gefallen