GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  PL/SQL
Go To First  |  Previous Question  |  Next Question 
 PL/SQL  |  Question 26 of 166    Print  
How to fetch the rows by dynamicaly passing table name through cursor

  
Total Answers and Comments: 5 Last Update: July 30, 2007     Asked by: sweety 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
April 04, 2006 01:45:03   #1  
praveen.pinisetti Member Since: April 2006   Contribution: 6    

RE: How to fetch the rows by dynamicaly passing table ...

We have to use stored procedure and parameterized cursor.

1) Write a stored procedure which takes table name as IN parameter.

2) Pass that table name as a parameter to cursor(using PARAMETERIZE CURSOR)

3) Fetch the rows u need

4) execute that procedure.


 
Is this answer useful? Yes | No
April 19, 2006 06:19:21   #2  
Kashif        

RE: How to fetch the rows by dynamicaly passing table ...

Hi praveen

I don't think table name can be passed as parameter to cursor. In this case we need to use ref-cursor .Am I right Do let me know.


 
Is this answer useful? Yes | No
April 23, 2006 01:11:56   #3  
Divesh Bansal        

RE: How to fetch the rows by dynamicaly passing table ...
Hi Table name cant be passed as paramter in cursor. Se have to go with the ref curson where we will write the dynamic sql Please mail me for furhet discuss Thanks Divesh
 
Is this answer useful? Yes | No
June 27, 2007 23:14:51   #4  
CHINMAY        

RE: How to fetch the rows by dynamicaly passing table ...

Yes
You are right we can only pass the value for where clause in paramterised cursor

 
Is this answer useful? Yes | No
July 30, 2007 08:04:57   #5  
lieni        

RE: How to fetch the rows by dynamicaly passing table ...
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.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
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