Home  >  Article  >  Database  >  Oracle中PL/SQL中if语句的写法介绍

Oracle中PL/SQL中if语句的写法介绍

ringa_lee
ringa_leeOriginal
2018-05-14 15:59:202557browse

以下是对Oracle中PL/SQL中if语句的写法进行了详细的分析介绍,需要的朋友可以过来参考下 复制代码 代码如下: /* If语句: 判断用户输入的数字。 */ set serveroutput on --接收键盘输入 accept num prompt '请输入一个数字:'; declare --将屏幕输入的数字

以下是对Oracle中PL/SQL中if语句的写法进行了详细的分析介绍,需要的朋友可以过来参考下

复制代码 代码如下:

/*
If语句:
判断用户输入的数字。
*/
set serveroutput on
--接收键盘输入
accept num prompt '请输入一个数字:';
declare 
  --将屏幕输入的数字付给变量
  pnum number := #
begin
  if pnum = 0 then dbms_output.put_line('您输入的是0');
  end if;

  if pnum = 1 then dbms_output.put_line('您输入的是1');
  end if;  

  if pnum = 2 then dbms_output.put_line('您输入的是2');
  end if;  
end;
/
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn