Question:
How we can create a table through procedure ?
Answer:
You can create table from procedure using Execute immediate command. Source: CoolInterview.com
Answered by: Ajay Kumar | Date: 10/29/2007
| Contact Ajay Kumar
create procedure p1 is begin EXECUTE IMMEDIATE 'CREATE TABLE temp AS SELECT * FROM emp ' ; END; / Source: CoolInterview.com
Answered by: sunny talent09 | Date: 11/30/2007
| Contact sunny talent09
You can create table from procedure using Execute immediate command.
create procedure p1 is begin EXECUTE IMMEDIATE 'CREATE TABLE temp AS SELECT * FROM emp ' ; END; Source: CoolInterview.com
Answered by: fucker | Date: 12/23/2007
| Contact fucker
create procedure p1 (p_table_name IN VARCHAR(50)) is begin EXECUTE IMMEDIATE 'CREATE TABLE '|| p_table_name ||' AS SELECT * FROM emp ' ; END; Source: CoolInterview.com
Answered by: Aveek | Date: 2/27/2008
| Contact Aveek
The above answer is not working. procedure is created but not table. how to call procedure? Source: CoolInterview.com
Answered by: SUJATHA | Date: 6/27/2008
| Contact SUJATHA
Call p1; Source: CoolInterview.com
Answered by: yakub ali khan | Date: 7/30/2008
| Contact yakub ali khan
create or replace procedure create_tab(dt date) AUTHID CURRENT_USER is v_date varchar2(8) := to_char(dt,'DDMMYYYY'); v_time varchar2(4) := to_char(dt,'HH24MI'); v_str varchar2(255); Begin v_str := 'Create table '||'ABC'||'_'||v_date||'_'||v_time||'(no NUMBER(2),name varchar2(10))'; Execute immediate v_str; End;
Hope this works fine Source: CoolInterview.com
Answered by: MANISH KUMAR | Date: 7/7/2009
| Contact MANISH KUMAR
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|