I want to create a table random_record that takes in the same columns as another table simulated_records; one of the columns is grade. But I keep getting this error:
ERROR: "random_record.grade" is not a known variable
LINE 45: random_record.grade = c_grade;
^********** Error **********
ERROR: "random_record.grade" is not a known variable
SQL state: 42601
Character: 1635
FOR i IN 1..6 LOOP
CREATE TABLE random_record AS
SELECT ....
IF random_record.grade = '-' THEN
.....
END IF;
....
END LOOP;
I am not sure if I am properly creating the table.
CASE ... WHENas part of theCREATE TABLE AS ... SELECT ...