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 coalesce sql?

0 Answers  


What is clustered, non-clustured and unique index. How many indexes can be created on a table ?

3 Answers   TCS,


Explain what is a field in a database and record in a database?

0 Answers  


what is the difference between primary key and unique key? : Sql dba

0 Answers  


A table was given with 3 columns like Manager id,Manager Name and Employee name. Question was to create hierarchy.

2 Answers   TCS,






Write a sql query to find the names of employees that begin with ‘a’?

0 Answers  


Delete the emps whose salaries are lowest sals of their own dept.

5 Answers  


What is union and union all keyword in sql?

0 Answers  


what is meant by urlencode and urldocode? : Sql dba

0 Answers  


What does <> sql mean?

0 Answers  


how to show all tables with 'mysql'? : Sql dba

0 Answers  


What is a function in oracle pl sql?

0 Answers  


Categories