Create a stored procedure ( P_DYN_TABLE) that creates a table DYNAMICALLY by hav
ID: 3766294 • Letter: C
Question
Create a stored procedure ( P_DYN_TABLE) that creates a table DYNAMICALLY by having 2 input parameters, 1 which is the SOURCE table for that new table, and the second input is the name of the new table. You will need to define two statements, 1 for the structure of the table, AND 1 statement to populate it (Hint for the first statement you will need to build the CREATE statement by concatenating the NEW table name and the SOURCE table. For the second statement you will need to use the PREPARE and EXECUTE commands.)
Explanation / Answer
create or replace procedure P_DYN_TABLE(SOURCE in varchar(20), NEWTABLE in varchar(20)) is
begin
create table NEWTABLE (rollno number, name varchar(20), marks number);
SELECT * INTO newtable FROM source;
dbms_output.put_line('New Table created and populated');
end;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.