⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conditional.sql

📁 Oracle 9i PL/SQL程序设计的随书源码
💻 SQL
字号:
REM Conditional.sql
REM Chapter 1, Oracle9i PL/SQL Programming by Scott Urman
REM This block illustrates a conditional statement.

DECLARE
  v_TotalStudents NUMBER;
BEGIN
  -- Retreive the total number of students from the database.
  SELECT COUNT(*)
    INTO v_TotalStudents
    FROM students;
    
  -- Based on this value, insert the appropriate row into temp_table.
  IF v_TotalStudents = 0 THEN
    INSERT INTO temp_table (char_col)
      VALUES ('There are no students registered');
  ELSIF v_TotalStudents < 5 THEN 
    INSERT INTO temp_table (char_col)
      VALUES ('There are only a few students registered');
  ELSIF v_TotalStudents < 10 THEN
    INSERT INTO temp_table (char_col)
      VALUES ('There are a little more students registered');
  ELSE
    INSERT INTO temp_table (char_col)
      VALUES ('There are many students registered');
  END IF;
END;
/


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -