I am working on the stored procedure. However, I am stuck a little and cannot figure out how to get my procedure to run. I did the first part of the question, which is to create the table instructor_course_nums. Then I went on to write the second portion, but I am stuck. Could someone please take a look the stored procedure and help me to get it to run?
Hello,
I am working on the stored procedure. However, I am stuck a little and cannot figure out how to get my procedure to run.
I did the first part of the question, which is to create the table instructor_course_nums. Then I went on to write the second portion, but I am stuck.
Could someone please take a look the stored procedure and help me to get it to run?
Code
---created table here as the first part of the problem
CREATE TABLE instructor_course_nums (
ID_Number INTEGER,
name VARCHAR(30),
tot_courses VARCHAR(30),
CONSTRAINT instructor_course_nums_pkey PRIMARY KEY (ID_Number)
);
--- second part of the problem. See procedure below
CREATE OR REPLACE PROCEDURE Moreno_03_insCourseNumsProc(INOUT i_ID VARCHAR(5))
LANGUAGE PLPGSQL
AS
$$
BEGIN
SELECT name INTO instructor_course_nums FROM instructor WHERE instructor.id = i_id;
SELECT COUNT(*) INTO instructor_course_nums FROM teaches WHERE teaches.id = i_id;
SELECT COUNT(*) INTO instructor_course_nums FROM instructor_course_nums WHERE instructor_id= i_id;
END;
$$;
Thank you so much!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps