Introduction to the Writing of if in Oracle and SQL

  • 2021-10-16 05:20:39
  • OfStack


/*
If Statement: 
 Judge the number entered by the user. 
*/
set serveroutput on
-- Receive keyboard input 
accept num prompt ' Please enter 1 Number :';
declare 
  -- Pay the number entered on the screen to the variable 
  pnum number := #
begin
  if pnum = 0 then dbms_output.put_line(' What you entered is 0');
  end if;

  if pnum = 1 then dbms_output.put_line(' What you entered is 1');
  end if;  

  if pnum = 2 then dbms_output.put_line(' What you entered is 2');
  end if;  
end;
/


Related articles: