Đang tải... (xem toàn văn)
Lesson Working with Oracle present the content: using oracle documentation, database concepts, ACID — Atomicity, ACID — Consistency, ACID — Isolation, ACID — Durability, locking and blocking, oracle environment variables, introducing SQL, types of SQL commands...
statements in SQL*Plus • Refer to SQL*Plus User’s Guide for Documentation • Enter the following: SQL> set property_name new_value • Example of a set of statements to customize SQL*Plus: SQL> SQL> SQL> SQL> SQL> set set set set set linesize 132 pagesize 100 echo on long 4000 autocommit off Generating Output To generate output to a file, enter: SQL> spool path_to_file • This writes everything into the file at given path – Use the following command to see what is being written to the file: set echo on • If the file has no extension, lst is created • It overwrites the existing file To buffer writes and stop spooling of output, enter SQL> spool off Unix Overview 21 Customizing Output To customize output, enter: SQL> column column_name format format This changes the default length and format of column output SQL> select bu_nam from cz_bus_unit where bu_unit = 0; BU_NAM -SYSTEM SQL> column bu_nam format a10 SQL> / BU_NAM -SYSTEM Working with Oracle Basic SQL Commands Unix Overview 22 Basic Commands Command description SQL Command Show user show user; List tables in current schema select table_name from user_tables; List tables current user select table_name from all_tables has access to See table description desc ; Repeat last command / Basic Commands Command description SQL Command Set number lines per page to n Set pagesize n (no semicolon used) Set number columns to n Set linesize n (no semicolon used) Count the rows of a table select count(*) from ; List the top n rows of a select * from table in order (select * from order by ) where rownum column bu_nam format a10 SQL> / BU_NAM -SYSTEM Working with Oracle Basic SQL Commands Unix Overview 22 Basic Commands Command description SQL Command