| |
GeekInterview.com > Interview Questions > Oracle > PL/SQL
| Print | |
Question: Pipe Function and Mutating Trigger
Answer: 1) Why we use pl/sql array rather than cursor? 2) In which condition we use function overloading? 3) What is pipe function? 4) What is the mutating trigger? What should be the condition? |
| November 11, 2008 13:49:09 |
#1 |
| vnraos |
Member Since: April 2008 Total Comments: 3 |
RE: Pipe Function and Mutating Trigger |
Harit 1.Cursor is basically a select statement with a where condition which returns more than one row mostly. The fetch from cursor, being a part of a procedure or function, are later updated(like increasing salary etc) or deleted (stock older than two years moved to another location etc.)
2.Where as arrays are used to store more than one phone number or email ids or addresses of a person. And arrays are DataType. Can be Number, Character, Objecttype etc.
Thus cursor can select as many columns from a table and acts as a memory area which is explicitly managed by programmer to store and clear once the defined purpoe is over. Array(Varray) is a datatype of any pl/sql variable.
3.Overloaded function or procedure are broadly same program units with same name different parameters. To give an easy understandability you can follow this convention. For example you can create two procedures with name Admit_student(Group,Major) and Admit_student(Group,Major,Class) for admitting students . In the first case you wish to supply only Group (Science,Biology,IT) and in the second case you wish to supply Class(Honours,Ordinary) also.
4. A trigger is defined for an DML (Insert, Update or Delete)action and is refering to the table which it is changing. For example The trigger is defined on a Table Employees "After Insert" and the body of the trigger prefers to "Insert in to Employee (dept) values("New Department") where employee_name = "Mohan"..... "One of the suggested solution is to use a view. I have given a very crude example. You may refer to Scott Urman book or anyother. |
| |
Back To Question | |