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

📄 contextarea2.sql

📁 介绍Oracle PL SQL编程
💻 SQL
📖 第 1 页 / 共 2 页
字号:

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72127171', 'IN STOCK', NULL, 1000);

PROMPT Oracle Security Handbook
PROMPT by Marlene Theriault, Aaron Newman
INSERT INTO authors (id, first_name, last_name)
  VALUES (34, 'Aaron', 'Newman');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2)
  VALUES ('72133252', 'Oracle Server', 'Oracle Security Handbook', 624, 59.99, 2001, 1, 34);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72133252', 'IN STOCK', NULL, 1000);

PROMPT Oracle High-Performance SQL Tuning
PROMPT by Donald Burleson
INSERT INTO authors (id, first_name, last_name)
  VALUES (35, 'Donald', 'Burleson');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72190582', 'Oracle Server', 'Oracle High-Performance SQL Tuning', 656, 49.99, 2001, 35);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72190582', 'IN STOCK', NULL, 1000);

PROMPT Oracle9i for Windows(R) Handbook
PROMPT by Anand Adkoli, Rama Velpuri
INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2)
  VALUES ('72190922', 'Oracle Server', 'Oracle9i for Windows(R) Handbook', 528, 49.99, 2002, 33, 32);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72190922', 'IN STOCK', NULL, 1000);

PROMPT Oracle9i PL/SQL Programming
PROMPT by Scott Urman
INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72191473', 'Oracle Server', 'Oracle9i PL/SQL Programming', 664, 49.99, 2002, 26);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72191473', 'IN STOCK', NULL, 1000);

PROMPT Oracle9i DBA Handbook
PROMPT by Kevin Loney, Marlene Theriault
INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2)
  VALUES ('72193743', 'Oracle Server', 'Oracle9i DBA Handbook', 1008, 59.99, 2002, 27, 1);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72193743', 'IN STOCK', NULL, 1000);

PROMPT Oracle9i Web Development
PROMPT by Brad Brown
INSERT INTO authors (id, first_name, last_name)
  VALUES (36, 'Brad', 'Brown');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72193883', 'Oracle Server', 'Oracle9i Web Development', 1120, 59.99, 2001, 36);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72193883', 'IN STOCK', NULL, 1000);

PROMPT Oracle 9i JDBC Programming
PROMPT by Jason Price
INSERT INTO authors (id, first_name, last_name)
  VALUES (37, 'Jason', 'Price');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72222549', 'Oracle Server', 'Oracle 9i JDBC Programming', 608, 49.99, 2002, 37);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72222549', 'IN STOCK', NULL, 1000);

PROMPT Oracle9i UNIX Administration Handbook
PROMPT by Donald Burleson
INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72223049', 'Oracle Server', 'Oracle9i UNIX Administration Handbook', 560, 49.99, 2002, 35);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72223049', 'IN STOCK', NULL, 1000);

PROMPT Oracle 9i New Features
PROMPT by Robert Freeman
INSERT INTO authors (id, first_name, last_name)
  VALUES (38, 'Robert', 'Freeman');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72223855', 'Oracle Server', 'Oracle 9i New Features', 244, 29.99, 2002, 38);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72223855', 'IN STOCK', NULL, 1000);

PROMPT Oracle9i: The Complete Reference
PROMPT by Kevin Loney, George Koch
INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2)
  VALUES ('72225211', 'Oracle Server', 'Oracle9i: The Complete Reference', 1256, 74.99, 2002, 27, 29);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72225211', 'IN STOCK', NULL, 1000);

PROMPT Oracle9i RMAN Backup ~& Recovery
PROMPT by Robert Freeman, Matthew Hart
INSERT INTO authors (id, first_name, last_name)
  VALUES (39, 'Matthew', 'Hart');

INSERT INTO authors (id, first_name, last_name)
  VALUES (52, 'Dave', 'Faulkner');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2)
  VALUES ('72226625', 'Oracle Server', 'Oracle9i RMAN Backup ~& Recovery', 608, 49.99, 2003, 38, 39);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72226625', 'IN STOCK', NULL, 1000);

PROMPT Oracle Database 10g New Features
PROMPT by Robert Freeman
INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72229470', 'Oracle Server', 'Oracle Database 10g New Features', 272, 34.99, 2004, 38);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72229470', 'IN STOCK', NULL, 5000);

PROMPT Oracle Database 10g XML ~& SQL Design, Build, ~& Manage XML Applications in Java, C, C++, ~& PL/SQL
PROMPT by Mark Scardina, Ben Chang, Jinyu Wang
INSERT INTO authors (id, first_name, last_name)
  VALUES (40, 'Mark', 'Scardina');

INSERT INTO authors (id, first_name, last_name)
  VALUES (41, 'Ben', 'Chang');

INSERT INTO authors (id, first_name, last_name)
  VALUES (53, 'George', 'Hardman');

INSERT INTO authors (id, first_name, last_name)
  VALUES (42, 'Jinyu', 'Wang');

INSERT INTO authors (id, first_name, last_name)
  VALUES (51, 'Scott', 'Boudreaux');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2, author3)
  VALUES ('72229527', 'Oracle Server', 'Oracle Database 10g XML ~& SQL Design, Build, ~& Manage XML Applications in Java, C, C++, ~& PL/SQL', 656, 49.99, 2004, 40, 41, 42);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72229527', 'IN STOCK', NULL, 5000);

PROMPT Oracle Database 10g SQL
PROMPT by Jason Price
INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72229810', 'Oracle Server', 'Oracle Database 10g SQL', 624, 49.99, 2004, 37);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72229810', 'IN STOCK', NULL, 5000);

PROMPT Oracle Database 10g Linux Administration
PROMPT by Wim Coekaerts
INSERT INTO authors (id, first_name, last_name)
  VALUES (43, 'Wim', 'Coekaerts');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72230533', 'Oracle Server', 'Oracle Database 10g Linux Administration', 560, 49.99, 2004, 43);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72230533', 'IN STOCK', NULL, 5000);

PROMPT Oracle Database 10g PL/SQL Programming
PROMPT by Ron Hardman, Mike McLaughlin, and Scott Urman
INSERT INTO authors (id, first_name, last_name)
  VALUES (44, 'Ron', 'Hardman');

INSERT INTO authors (id, first_name, last_name)
  VALUES (49, 'Mike', 'McLaughlin');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2, author3)
  VALUES ('72230665', 'Oracle Server', 'Oracle Database 10g PL/SQL Programming', 1008, 54.99, 2004, 44, 49, 26);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72230665', 'IN STOCK', NULL, 5000);

PROMPT Unbreakable Oracle by Design Oracle Database 10g Security
PROMPT by David Knox
INSERT INTO authors (id, first_name, last_name)
  VALUES (45, 'David', 'Knox');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1)
  VALUES ('72231300', 'Oracle Server', 'Unbreakable Oracle by Design Oracle Database 10g Security', 560, 59.99, 2004, 45);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72231300', 'IN STOCK', NULL, 5000);

PROMPT Oracle Database 10g High Availability with RAC, Flashback, and Data Guard
PROMPT by Matthew Hart, Scott Jesse
INSERT INTO authors (id, first_name, last_name)
  VALUES (46, 'Scott', 'Jesse');

INSERT INTO authors (id, first_name, last_name)
  VALUES (50, 'Tom', 'Doebler');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2)
  VALUES ('72254289', 'Oracle Server', 'Oracle Database 10g High Availability with RAC, Flashback, and Data Guard', 496, 59.99, 2004, 39, 46);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('72254289', 'IN STOCK', NULL, 5000);

PROMPT Oracle PL/SQL Tips and Techniques
PROMPT by Rich Niemic, Brad Brown, Joe Trezzo
INSERT INTO authors (id, first_name, last_name)
  VALUES (47, 'Rich', 'Niemic');

INSERT INTO authors (id, first_name, last_name)
  VALUES (48, 'Joe', 'Trezzo');

INSERT INTO books (isbn, category, title, num_pages, price, copyright, author1, author2, author3)
  VALUES ('78824389', 'Oracle Server', 'Oracle PL/SQL Tips and Techniques', 942, 49.99, 1999, 47, 36, 48);

INSERT INTO inventory (isbn, status, status_date, amount)
  VALUES ('78824389', 'BACKORDERED', TO_DATE('06-JUN-2004', 'DD-MON-YYYY'), 1000);

COMMIT;

SET SERVEROUTPUT ON ESCAPE OFF

DECLARE

   v_first_name AUTHORS.FIRST_NAME%TYPE;
   
   /* Two identical queries to demonstrate the 
      impact of changes */

   CURSOR author_cur1 
   IS
      SELECT first_name
      FROM authors
      WHERE first_name like 'Ron%';

   CURSOR author_cur2
   IS
      SELECT first_name
      FROM authors
      WHERE first_name like 'Ron%';

BEGIN

   OPEN author_cur1;

   /* The first cursor is already open, so the record was retrieved
      with a first_name of Ron already.  */

   UPDATE authors
   SET first_name = 'Ronald'
   WHERE first_name = 'Ron';

   /* The second cursor is opened after the update, so the new first_name
      is retrieved as a result of the select */
   OPEN author_cur2;

   FETCH author_cur1 INTO v_first_name;
   DBMS_OUTPUT.PUT_LINE(v_first_name);

   FETCH author_cur2 INTO v_first_name;
   DBMS_OUTPUT.PUT_LINE(v_first_name);

   CLOSE author_cur1;
   CLOSE author_cur2;

   ROLLBACK;

END;
/

PROMPT
PROMPT ****  After the cursor is opened, the inventory table is dropped prior to looping
PROMPT ****  through the cursor.  NDS is used to drop the table, then all records
PROMPT ****  retrieved when the cursor is opened are displayed.
PROMPT
PROMPT DESC the inventory table...

DESC inventory

PROMPT Loop through the original records after the table was dropped...

DECLARE

   v_isbn INVENTORY.ISBN%TYPE;

   CURSOR inventory_cur
   IS
      SELECT isbn
      FROM inventory;

BEGIN
   OPEN inventory_cur;

   EXECUTE IMMEDIATE ('DROP TABLE inventory');

   LOOP
      FETCH inventory_cur INTO v_isbn;
      EXIT WHEN inventory_cur%NOTFOUND;

      DBMS_OUTPUT.PUT_LINE(v_isbn);

   END LOOP;

   CLOSE inventory_cur;

END;
/

PROMPT Confirm the table was dropped...
PROMPT

DESC inventory

⌨️ 快捷键说明

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