Q:

Write a program in PL/SQL to insert records from one table to another

0

Write a program in PL/SQL to insert records from one table to another.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

PL/SQL Code:

DROP TABLE emp_temp;
CREATE TABLE emp_temp (
  emp_id      NUMBER,
  emp_email  VARCHAR2(40)
);
 
DECLARE
  number_of_emp  NUMBER;
BEGIN
  SELECT COUNT(employee_id) INTO number_of_emp
  FROM employees;
  
  FOR i IN 1..number_of_emp LOOP
    INSERT INTO emp_temp (emp_id, emp_email)
    VALUES(i, 'not available now');
  END LOOP;
END;
/

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now