GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  PL/SQL
Go To First  |  Previous Question  |  Next Question 
 PL/SQL  |  Question 48 of 166    Print  
what would be the o/p for this ....
declare
cursor c1 is select * from employees;
emp_rec c1%rowtype;
begin
open c1;
delete from employees;
loop
fetch c1 into emp_rec;
exit when c1%notfound;
end loop;
close c1;
end;
tell me what is active set ?why you need cursors?
and what is going to happen when you use for update clause in cursor declaration
why use nowait clause what is its use

  
Total Answers and Comments: 2 Last Update: August 25, 2006     Asked by: basukolur014 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 21, 2006 05:41:09   #1  
Rama Krishna,Y        

RE: what would be the o/p for this ....declare
Hi Friend!! If you want to use the entire tale data from table in PL/SQL programing block you have to store the entire data in a temp buffer variable .. to syntronize that operation Oracle supports Cursor Variables..If you want to Lock the records in the table while u perofrming any DML you need to lock that table of rows..so you must use for update clasueThe output for the above program last record will be fetched finally and can be used ..Thanks&RegdsRamki TCS Hyd 9989018508
 
Is this answer useful? Yes | No
August 24, 2006 13:37:41   #2  
Sheetal        

RE: what would be the o/p for this ....declare

Hi

Your program will delete all rows from the table. If you print output after fetch from the cursor it will show all rows those where selected in the cursors.

When the cursor was created u selected all rows from the table. Then u opened the cursor that is active set is defined then u delete all rows from table. But as cusor's active set is already defined after fetch the output will be rows in the cursor.

If you would have reopened the cursor after deleting all rows from table then the cursor would be also blank.

For update is used to modify and delete rows in the cursor. For update is the lock so that no other user changes the rows in the cursor when u r changing it.

Nowait means before u lock the rows may be some other user had the lock on same rows in that case u will be in hang state till that user releases lock. Nowait clause will display error message to if some other user has the lock.

Hope this information helps you.


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Cursor is a private Sql area which is used to execute sql statements and store Processing information, Where as Refcursor is a data structure which points to an object which inturn points to memmory LocationThe advantage Refcursor over Normal Cursor is1.We ...

Latest Answer : By using cursor parameters we can pass the value dynamically. So that cursor can fetch data as per parameter ...
Read Answers (4) | Asked by : Kishorebabukm

Latest Answer : May be it is better to trace a select statment with on logon trigger.like:CREATE OR REPLACE TRIGGER SYS.ON_LOGON_ALL AFTER LOGON ON DATABASE WHEN (USER = 'MAX') BEGIN EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE=TRUE'; --EXECUTE IMMEDIATE ...
Read Answers (9) | Asked by : SumanNaidu.S

What is cursor? Explain the types of cursor and write one implicit cursor program to check how many records deleted from table?
Read Answers (6) | Asked by : indranil

Hi, in Cursors this is the Scenario.if i am manipulating the data of a table which has 10 records,i need to go to the 5th record.how is it possible?What is the Exact usage of Ref Cursor?
Read Answers (1) | Asked by : murthy

Latest Answer : %type will use for to define at column level.%rowtype is used to define for one or more than one columns ( like row or record or tuple ) means its user define type which hold one or more than one columns along with it. and generally it used with Cursor. ...

Latest Answer : Ref cursor is like a pointer to the cursor variable which is opened at the servecr side and pass the data as a whole and not one by one . ...

Latest Answer : Hi,Use the V$OPEN_CURSOR view to know how many cursors are currently open in the database.Guna Sagar Challa  ...
Read Answers (1) | Asked by : Amitava

Latest Answer : Yes you can pass the whole select statement of the cursor dynamicaly, see ref_cursors.There is also a system package sys.dbms_sql which allows everything to make dynamically. ...
Read Answers (5) | Asked by : sweety

When we need to use USING clause in the sql?For example in this below:SELECT emp_name, department_name, city FROM employees e JOIN departments d USING (department_id) JOIN locations l USING (location_id) WHERE salary > 10000; Can anyone explain what is mean of USING in this sql statement? or USING concept in brief? Thank you.
Read Answers (5) | Asked by : michelle


 Sponsored Links

 
Related Articles

Listening Skills - Become an Active Listener

Become an Active Listener Can you hear what people are really saying If you feel that you are lacking in the communication skills department this can be detrimental in the long run in terms of your career It is simply not possible to influence negotiate and persuade people all tools that you need to
 

Listening Skills - Active Listening

Active Listening What is Active Listening In a word active listening is the key to success in life It means the difference in listening processing and using information to one’ s advantage and merely hearing” what a person is saying i e letting it go in one ear and out the oth
 

What is Active Metadata Warehouse

An Active Metadata Warehouse is a repository of Metadata to help speed up data reporting and analyses from an active data warehouse. In its most simple definition, a Metadata is data describing data. Many companies have spent years and billions of dollars trying to cleanse, profile, extract, trans
 

What is Active Data Warehouse

Active Data Warehouse is repository of any form of captured transactional data so that they can be used for the purpose of finding trends and patterns to be used for future decision making. According to Bill Inmon, a prominent data warehousing practitioner, data warehouse defined in terms of subje
 

exit and return statements

  How does the exit () and return () differ exit () is used to exit the program as a whole. In other words it returns control to the operating system. After exit () all memory and temporary storage areas are all flushed out and control goes out of program. In contrast, the return () stateme
 

Assign values during declaration

How to assign values during declaration of variables Declaring variables tells the compiler the data type the variable is assigned and no storage area is allocated during this stage. It is possible to assign values during declaration itself. For example, consider the following program: main() {
 

JavaScript Window Object Open Method Part 2

JavaScript Window Object Open Method Part 2 In this JavaScript tutorial you will learn about JavaScript Window Object Open Method features of window object open method scrollbars status titlebar toolbar top width innerHeight innerWidth outerHeight outerWidth and hotkeys mosgoogle center scrollbars S
 

JavaScript Window Object Open Method

JavaScript Window Object Open Method In this JavaScript tutorial you will learn about JavaScript Window Object Open Method features of window object open method channelmode directories dependent fullscreen screenX screenY height left location menubar resizable alwaysLowered alwaysRaised mosgoogle ce
 

How To Select The Best CRM Solution For Your Business

How To Select The Best CRM Solution For Your Business When most people talk about Customer relationship management they use the term in a context that is connected to large corporations However the costs of CRM systems have continued to fall in the last few years and it is now in the price range of
 

Group Discussion - What Should Happen During a Group Discussion

What Should Happen During a Group Discussion In most cases the goal of a group discussion is to come up with ideas which will allow the group to solve specific problems or learn a skill The members must be able to summarize the primary points of the information they read and they should also be able
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape