Write a PL/SQL Program to do the following Your Program should request the user to enter the temperature. Then based on the users input your program should display the following messages a. Print "Hot" if the temperature is above 80 degrees, b. Print " Nice Weather" if it's between 50 and 80 degrees, c. Print "cold" if it is less than 50 degree
please use live oracle :
because when ever i run it it says:
Unsupported Command ORA-06550: line 6, column 11: PLS-00103: Encountered the symbol "&" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specif
this is the code:
-- Taking user input for temperature ACCEPT temp NUMBER PROMPT 'Enter temperature: ' -- Declaring temp variable to be used for comparision DECLARE temp number; -- Initializing value BEGIN temp := &temp; -- If temperature is greater than 85 IF ( temp >85 ) THEN dbms_output.put_line('Hot!' ); -- If temperature is less than 85 and greater than 55 ELSIF ( temp>55 AND temp<85) THEN dbms_output.put_line('Nice weather!' ); -- If temperature is lower than 40 ELSIF ( temp < 40 ) THEN dbms_output.put_line('Cold weather!' ); -- If block ends here END IF; end; /
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images