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 the maximum length of a table name, database name, and fieldname in mysql? : Sql dba

0 Answers  


Is it possible for a table to have more than one foreign key?

0 Answers  


declare v_count number(8,3); v_sal scott.emp.sal%type := '&P_sal'; cursor cur_name is select sal from scott.emp where sal between (v_sal-100) and (v_sal +1000); begin v_count :=nvl(sql%rowcount ,0); if v_count = 0 then dbms_output.put_line('no records are fetch in the given sal range'); else dbms_output.put_line('There is/are '||to_char(v_count)|| ' salaries are selected in the given range '); end if; end; in the above programm .....for any sal range ....always it shows the following message.. no records are fetch in the given sal range please find the mistake and share with me...with thansk and regards..sarao....

3 Answers   Satyam,


What is the purpose of using pl/sql?

0 Answers  


How to process query result in pl/sql?

0 Answers  






What are the different dml commands in sql?

0 Answers  


What is your daily office routine?

0 Answers   Data Vision,


what are the types of subquery? : Sql dba

0 Answers  


Does truncate remove indexes?

0 Answers  


Is a view faster than a stored procedure?

0 Answers  


How can check sql version from command line?

0 Answers  


What information is needed to connect sql*plus an oracle server?

0 Answers  


Categories