how to create table with in the procedure or function?

Answers were Sorted based on User's Feedback



how to create table with in the procedure or function?..

Answer / k.l.tharangini

create table using procedure

create procedure test as
begin
EXECUTE IMMEDIATE
'CREATE TABLE emp(empno VARCHAR(10),JOB VARCHAR(10),SAL
NUMBER(10))';
end;

Is This Answer Correct ?    43 Yes 3 No

how to create table with in the procedure or function?..

Answer / vipin kumar

If we need to create a table in the stored procedure then we need to use the execute immediate and then the string ' create table emp(name varcha2(1000))'



Other then this if we need to create a table which will just store the records (collections) then it will be like

--declare a row first
type employee is record
(Emp_name varchar2(100),
emp_id number);

--
-- Create a table now
--
type tab_employee is table of employee
index by binary_integer;

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More SQL PLSQL Interview Questions

what is a trigger in mysql? : Sql dba

0 Answers  


What is index example?

0 Answers  


What is a join?

0 Answers  


how to enter numeric values as hex numbers? : Sql dba

0 Answers  


Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table has 100 records after table created.Now i nee to change id's Datatype is to be Varchar2(15). now Alter table emp modify(id varchar2(15),name varchar2(20), salary number(9,2)); Whether it will work or returns error? post answer with explanation.

13 Answers   Oracle, TCS,






How do you optimize SQL queries ?

6 Answers   CarrizalSoft Technologies, Infosys, Oracle,


What are the different tcl commands in sql?

0 Answers  


What is difference between nchar and nvarchar?

0 Answers  


What is cursor and why it is required?

0 Answers  


How do I run a pl sql program?

0 Answers  


What is not equal in sql?

0 Answers  


What is clause in sql?

0 Answers  


Categories