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 the maximum length of a table name, database name, and fieldname in mysql? : Sql dba
Is it possible for a table to have more than one foreign key?
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....
What is the purpose of using pl/sql?
How to process query result in pl/sql?
What are the different dml commands in sql?
What is your daily office routine?
what are the types of subquery? : Sql dba
Does truncate remove indexes?
Is a view faster than a stored procedure?
How can check sql version from command line?
What information is needed to connect sql*plus an oracle server?