ExcelStore

Расширенные возможности SQL - Команд SQL в рамках урока #15

Dec 7th, 2021
1,944
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Основы работы с SQL Plus (часть 2)
  2. -- https://youtu.be/L_A0ibKsuhQ
  3.  
  4. -------------------------------------------
  5. -- Расширенные возможности SQL. Примеры команд и запросов SQL в рамках урока #15.
  6.  
  7. Windows + R
  8.  
  9. chcp 1251
  10. sqlplus
  11.  
  12. hr@XEPDB1
  13. hr2020
  14.  
  15.  
  16. @echo off
  17. chcp 1251
  18. sqlplus hr/hr2020@XEPDB1
  19.  
  20.  
  21. SELECT * FROM regions
  22. WHERE REGION_ID >= 1;
  23.  
  24.  
  25. START region.SQL
  26. @region.SQL
  27. @temp/region.SQL
  28.  
  29.  
  30. SELECT * FROM regions
  31. WHERE REGION_ID >= &REG_ID_1 AND REGION_ID <= &REG_ID_2;
  32.  
  33.  
  34. @region.SQL 3 8
  35.  
  36.  
  37. SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY FROM employees
  38. WHERE rownum <= 5;
  39.  
  40.  
  41. @region.SQL 2 8
  42.  
  43.  
  44. SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY FROM employees
  45. WHERE rownum <= &3;
  46.  
  47.  
  48. @region.SQL 2 8 10
  49.  
  50.  
  51. DECLARE
  52.   v NUMBER;
  53. BEGIN
  54.   SELECT COUNT(*) INTO v
  55.   FROM employees;
  56.   dbms_output.put_line(chr(13));
  57.   dbms_output.put_line('Result PL/SQL: ' || v);
  58.   dbms_output.put_line(chr(13));
  59. END;
  60. /
  61.  
  62.  
  63. SET SERVEROUTPUT ON
  64.  
  65. @region.SQL 2 8 10
  66. @employees.SQL
  67.  
  68.  
  69. SELECT * FROM employees;
  70.  
  71.  
  72. @select_empl.SQL
  73.  
  74.  
  75. SET linesize 30000
  76. SET pagesize 1000
  77.  
  78. @select_empl.SQL
  79.  
  80. SPOOL RESULT.txt
  81. SPOOL OFF
  82.  
  83. @select_empl.SQL
  84.  
  85. SET termout off
  86. SET markup csv ON
  87. SET feedback off
  88.  
RAW Paste Data