I am looking for some help to solve this question. I cannot figure out how to solve it and the code below is all I have. The application being used: PostgreSQL edition 12 or 13. I must use LANGUAGE PLPGSLQ as that is what the professor is looking for.
Hi,
I am looking for some help to solve this question. I cannot figure out how to solve it and the code below is all I have.
The application being used: PostgreSQL edition 12 or 13. I must use LANGUAGE PLPGSLQ as that is what the professor is looking for.
Thank you for your help.
Tables in the DB:
instructor (id, name, dept_name, salary)
teaches (id, course_id, sec_id, semester, year)
CREATE TEMPORARY TABLE instructor_course_nums (
ID VARCHAR(5),
name VARCHAR(20),
tot_courses INTEGER
);
CREATE OR REPLACE PROCEDURE Moreno_03_insCourseNumsProc(INOUT i_ID VARCHAR(5))
LANGUAGE PLPGSQL
AS
$$
BEGIN
SELECT name INTO instructor.name FROM instructor WHERE instructor.id = i_id;
SELECT COUNT(*) INTO course FROM teaches WHERE teaches.id = i_id;
SELECT COUNT(*) INTO l_Exist_count FROM instructor_course_nums WHERE instructor_id= i_id;
END;
$$;
Trending now
This is a popular solution!
Step by step
Solved in 2 steps