下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Using SQL*Plus ObjectivesAfter completing this appendix, you should be able to do the following:Log in to SQL*PlusEdit SQL commandsFormat output using SQL*Plus commandsInteract with script filesSQL and SQL*Plus InteractionBufferServerSQL statementsQuery resultsSQL scriptsSQL*PlusSQL Statements Versu
2、sSQL*Plus Commands SQLA languageANSI-standardKeywords cannot beabbreviatedStatements manipulate dataand table definitions in thedatabaseSQLstatementsSQLbufferSQL*Plus commandsSQL*Plus bufferSQL*Plus An environmentOracle-proprietaryKeywords can be abbreviatedCommands do not allow manipulation of valu
3、es in the databaseOverview of SQL*Plus Log in to SQL*Plus.Describe the table structure.Edit your SQL statement.Execute SQL from SQL*Plus.Save SQL statements to files and append SQL statements to files.Execute saved files.Load commands from file to buffer to edit.sqlplus username/passworddatabaseLogg
4、ing in to SQL*Plus 12Changing the Settings of SQL*Plus EnvironmentDisplaying Table StructureUse the SQL*Plus DESCRIBE command to display the structure of a table:DESCRIBE tablenameDisplaying Table StructureName Null? Type- - -DEPARTMENT_ID NOT NULL NUMBER(4)DEPARTMENT_NAME NOT NULL VARCHAR2(30)MANAG
5、ER_ID NUMBER(6)LOCATION_ID NUMBER(4)DESCRIBE departmentsSQL*Plus Editing CommandsAPPEND textCHANGE / old / newCHANGE / text /CLEAR BUFFERDELDEL nDEL m nSQL*Plus Editing CommandsINPUTINPUT textLISTLIST nLIST m n RUNnn text0 textUsing LIST, n, and APPENDLIST 1 SELECT last_name 2* FROM employees1 1* SE
6、LECT last_nameA , job_id 1* SELECT last_name, job_idLIST 1 SELECT last_name, job_id 2* FROM employeesUsing the CHANGE CommandLIST 1* SELECT * from employeesc/employees/departments 1* SELECT * from departmentsLIST 1* SELECT * from departmentsSQL*Plus File CommandsSAVE filenameGET filenameSTART filena
7、me filenameEDIT filenameSPOOL filenameEXITUsing the SAVE, START, and EDIT CommandsLIST 1 SELECT last_name, manager_id, department_id 2* FROM employeesSAVE my_query Created file my_querySTART my_queryLAST_NAME MANAGER_ID DEPARTMENT_ID- - -King 90Kochhar 100 90.107 rows selected.Using the SAVE, START,
8、 and EDIT CommandsEDIT my_querySERVEROUTPUT CommandUse the SET SERVEROUTPUT command to control whether to display the output of stored procedures or PL/SQL blocks in SQL*Plus. The DBMS_OUTPUT line length limit is increased from 255 bytes to 32767 bytes.The default size is now unlimited.Resources are
9、 not pre-allocated when SERVEROUTPUT is set.Because there is no performance penalty, use UNLIMITED unless you want to conserve physical memory.SET SERVEROUTPUT ON | OFF SIZE n | UNLIMITED FORMAT WRAPPED | WORD_WRAPPED | TRUNCATEDUsing the SQL*Plus SPOOL CommandSPOOL file_name.ext CREATE | REPLACE |
10、APPEND | OFF | OUTOptionDescriptionfile_name.extSpools output to the specified file name.CREATECreates a new file with the name specified.REPLACEReplaces the contents of an existing file. If the file does not exist, REPLACE creates the file.APPENDAdds the contents of the buffer to the end of the fil
11、e you specify.OFFStops spooling.OUTStops spooling and sends the file to your computers standard (default) printer.Using the AUTOTRACE CommandDisplays a report after the successful execution of SQL DML statements such as SELECT, INSERT, UPDATE or DELETE.The report can now include execution statistics and the query execution path.SET AUTOTRACE ON | OFF | TRACEONLY EXPLAIN STATISTICSSET AUTOTRACE ON- The AUTOTRACE report includes both the optimizer- execution path and the SQL statement execution - statistics.Sum
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025广东广州生物院联合生科院张笑人教授课题组科研助理招聘参考考试试题及答案解析
- 广安市前锋区就业保障中心2025年12月公开招聘公益性岗位备考笔试题库及答案解析
- 2026辽宁本溪市教育系统冬季名校优生引进急需紧缺人才4人(本溪市第一中学)参考笔试题库附答案解析
- 2025云南丽江市华坪县择优招聘云南省职业教育省级公费师范毕业生4人备考考试试题及答案解析
- 2025贵州黔南州面向社会招聘国有企业工作人员考察(第三批)参考考试题库及答案解析
- 2026甘肃甘南州夏河县兵役登记暨征兵参考笔试题库附答案解析
- 2026年玉溪澄江市教育体育系统招聘毕业生(20人)参考考试试题及答案解析
- 四川省大英中学2025年临聘教师招聘备考笔试试题及答案解析
- 2026年莆田市荔城区公开考核新任教师招聘53人备考笔试题库及答案解析
- 网址注册合同范本
- 知识产权保护风险排查清单模板
- 第一单元任务三《新闻写作》教学设计-2025-2026学年统编版语文八年级上册
- 2025年广西高校教师资格岗前培训考试(高等教育学)历年参考题库含答案详解(5卷)
- 2025年嫩江市招聘农垦社区工作者(88人)笔试备考试题附答案详解(基础题)
- 2025年驾考科目三安全考试题库
- 熔盐储热技术原理
- IATF16949中英文对照版2025-10-13新版
- 肩关节脱位的护理
- 电子商务数据分析-数据采集
- 2025年保安员资格考试题目及答案(共100题)
- 大学家属院物业管理办法
评论
0/150
提交评论