nomatch.sql

来自「Oracle 9i PL/SQL程序设计的随书源码」· SQL 代码 · 共 31 行

SQL
31
字号
REM NoMatch.sql
REM Chapter 6, Oracle9i PL/SQL Programming by Scott Urman
REM This script illustrates the use of cursor attributes on the
REM implicit SQL cursor.

BEGIN
  UPDATE rooms
    SET number_seats = 100
    WHERE room_id = 99980;
  -- If the previous UPDATE statement didn't match any rows, 
  -- insert a new row into the rooms table.
  IF SQL%NOTFOUND THEN
    INSERT INTO rooms (room_id, number_seats)
      VALUES (99980, 100);
  END IF;
END;
/

BEGIN
  UPDATE rooms
    SET number_seats = 100
    WHERE room_id = 99980;
  -- If the previous UPDATE statement didn't match any rows, 
  -- insert a new row into the rooms table.
  IF SQL%ROWCOUNT = 0 THEN
    INSERT INTO rooms (room_id, number_seats)
      VALUES (99980, 100);
  END IF;
END;
/

⌨️ 快捷键说明

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