database - What is wrong with my PL/SQL block? -
I have a written program for calculating the average points of students:
DECLARE rno number (10); Wt NUMBER (10); DBMS Number (10); From NUMBER (10); Torque number (10); Per float (10); Total NUMBER (10); Start: = & amp; Rno; Wt: = & amp; Wt; DBMS: = & amp; DBMS; From: = & amp; From; Toc: = & amp; Toc; If (wt & lt; 40 or to & lt; 40 or toc & lt; 40 or dbms & lt; 40) THEN dbms_output.Put_line ('unsuccessful'); Total: = (wt + to + toc + dbms); To: = (total / 400) * 100; If (per & gt; 75) THEN dbms_output.Put_line ('Grade A'); ELSIF (per gt; 65 and per & lt; 75) THEN dbms_output.Put_line ('Grade B'); ELSIF (per gt; 40 & amp; nbsp; & lt; 65) THEN dbms_output.Put_line ('grade c'); ELSE dbms_output.Put_line ('Invalid input'); end if; Dbms_output.Put_line ('percent is' || per); end if; End; / There is no error in the program. But the output of the program is as follows: Enter the value for rno: 1 old 10: rno: = & amp; Rno; New 10: Rano: = 1; Enter value for Wt: 23 old 11: wt: = & amp; Wt; New 11: wt: = 23; Enter the value for DBMS: 56 old 12: DBMS: = & amp; DBMS; New 12: DBMS: = 56; Enter the value for Save: 74 old 13: from: = & amp; From; New 13: from: = 74; Enter the value for TOC: 84 old 14: toc: = & amp; Toc; New 14: toc: = 84; PL / SQL Process successfully complete SQL & gt; Enter the value for / Rno: 2 old 10: Runo: = & amp; Rno; New 10: rno: = 2; Enter value for Wt: 45 old 11: wt: = & amp; Wt; New 11: wt: = 45; Enter the value for DBMS: 25 OLD 12: DBMS: = & amp; DBMS; New 12: dbms: = 25; Enter the value for: 73 old 13: from: = & amp; From; New 13: from: = 73; Enter the value for TOC: 22 old 14: toc: = & amp; Toc; New14: toc: = 22; The PL / SQL process successfully completed This program does not reach the 'if' statement further. help please.
As it says, if you are using SQL Developer, you should see VIEW_ & gt; Must be turned on; DBMS_OUTPUT, then click on the green plus icon to enable output, it works on my computer, it was not working before, but what is doing now is doing it. Now the code works fine on your computer and I get the output:
failed input input percent 10 for SQL_Plus
Sets server output
does 2 things:
1) Each statement tells SQLPLUS to dump the output 2) It releases sqlplus dbms_output.enable
Edit: The second input of your question was really correct
failed grade c percent is41.25
Comments
Post a Comment