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 a trigger in mysql? : Sql dba
What is index example?
What is a join?
how to enter numeric values as hex numbers? : Sql dba
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.
How do you optimize SQL queries ?
6 Answers CarrizalSoft Technologies, Infosys, Oracle,
What are the different tcl commands in sql?
What is difference between nchar and nvarchar?
What is cursor and why it is required?
How do I run a pl sql program?
What is not equal in sql?
What is clause in sql?