GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 84 of 171    Print  
Can one use dynamic SQL statements from PL/SQL?
How can I use a variable for the columns/tables in the select statements?

  
Total Answers and Comments: 4 Last Update: August 08, 2007     Asked by: Rana 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
April 30, 2006 12:49:51   #1  
pandish Member Since: April 2006   Contribution: 7    

RE: Can one use dynamic SQL statements from PL/SQL?
try using execute immediate 'sql statement' ;
 
Is this answer useful? Yes | No
July 19, 2006 03:43:27   #2  
balaji        

RE: Can one use dynamic SQL statements from PL/SQL?

yes u can use dynamic sql statements in pl/sql.check the below code..

declare

v_empno emp.empno type : &empno;

v_ename emp.ename type;

v_sal emp.sal type;

begin

select ename sal into v_ename v_sal from emp where empno v_empno;

dbms_output.put_line('name : '||v_ename||' sal is :'||v_sal);

end;

(u have to set the serveroutput environment option to on)


 
Is this answer useful? Yes | No
August 02, 2006 12:08:28   #3  
Rama Krishna,Yerra        

RE: Can one use dynamic SQL statements from PL/SQL?

This is also another method..

Oracle Supports a built-in package

DBMS_SQL by this we can execure

We must use the following methods.

PARSE()

BIND()

Thanks&REgds

Ramki TCS Hyd


 
Is this answer useful? Yes | No
August 08, 2007 07:49:26   #4  
jitendra        

RE: Can one use dynamic SQL statements from PL/SQL?
You can use execute_imediate in PL/SQL.
 
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