(PL/SQL structure, Data types, Variable, DBMS Output and Conditions), try to combine the PL/SQL and the SQL, where you can use PL/SQL with SQL commands in manipulating the database. and this is my codes but i am having issues running it, can anyone help me please?
CREATE TABLE Grades(
  STUDENT_ID INT NOT NULL PRIMARY KEY,
  SName VARCHAR2(50),
  Grades NUMBER,
  Top_Average NUMBER(3)
);
INSERT INTO Grades(STUDENT_ID, SName, Grades, Top_Average)VALUES(1001,'Carmina',75);
INSERT INTO Grades(STUDENT_ID, SName, Grades, Top_Average)VALUES(1002,'Danielle',90,100);
INSERT INTO Grades(STUDENT_ID, SName, Grades, Top_Average)VALUES(1003,'Sophia',80,100);
INSERT INTO Grades(STUDENT_ID, SName, Grades, Top_Average)VALUES(1004,'Zoe',85,100);
INSERT INTO Grades(STUDENT_ID, SName, Grades, Top_Average)VALUES(1005,'Carlo',78,100);
SELECT * FROM Grades;
DECLARE
  Grades NUMBER:= 75;
  Top_Average NUMBER:= 100;
 
BEGIN
  dbms_output.put_line('The sum of ' || Grades ||' and ' || Top_Average || ' is ' || (Grades + Top_Average));
  dbms_output.put_line('The difference of ' || Grades ||' and ' || Top_Average || ' is ' || (Grades - Top_Average));
  dbms_output.put_line('The product of ' || Grades ||' and ' || Top_Average || ' is ' || (Grades * Top_Average));
 
if Top_Average = grades then
  dbms_output.put_line('The quotient of ' || Grades ||' and ' || Top_Average|| ' is ' || ' FAILED');
 
ELSE
  dbms_output.put_line('The quotient of ' || Grades ||' and ' || Top_Average || ' is ' || (Grades / Top_Average));
end if; 
end;
/
 
                       
                    
0 Answer(s)