how to create table with in the procedure or function?
Answers were Sorted based on User's Feedback
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 |
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 |
What is coalesce sql?
What is clustered, non-clustured and unique index. How many indexes can be created on a table ?
Explain what is a field in a database and record in a database?
what is the difference between primary key and unique key? : Sql dba
A table was given with 3 columns like Manager id,Manager Name and Employee name. Question was to create hierarchy.
Write a sql query to find the names of employees that begin with ‘a’?
Delete the emps whose salaries are lowest sals of their own dept.
What is union and union all keyword in sql?
what is meant by urlencode and urldocode? : Sql dba
What does <> sql mean?
how to show all tables with 'mysql'? : Sql dba
What is a function in oracle pl sql?