




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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年度高端珠宝店面特许经营权转让协议书
- 二零二五年度员工持股合伙协议书:新能源车辆研发团队股权激励与市场推广协议
- 二零二五年度实习就业协议书:地质勘探实习合同范本
- 二零二五年度文化产业合作协议解读:简述概念特点与文化创新
- 二零二五年度夫妻双方婚内财产保全与收益分配协议
- 二零二五年度夫妻财产保全及婚姻风险防范合同
- 二零二五年度民事调解协议书生效后的履行监督与法律援助
- 发展改革委电力安全生产总结
- 餐饮服务人员心态培训
- 加工项目分包合同范例
- 2024年湖北高考化学试卷(真题+答案)
- 人教版小学数学六年级上册重点题型专项练习及答案【易错题】
- 2024年共青团入团积极分子考试题库(附答案)
- DZ∕T 0273-2015 地质资料汇交规范(正式版)
- 埃森哲:中国智能制造+新蓝图+新四化
- 公文写作4通知、通告与通报市公开课一等奖省赛课微课金奖课件
- 基于协同过滤的算法研究
- 2024年江苏国信仪征 高邮热电有限责任公司招聘笔试参考题库含答案解析
- (高清版)DZT 0216-2020 煤层气储量估算规范
- 2022年4月自考00087英语翻译试题及答案含解析
- 大气污染与公共健康风险评估
评论
0/150
提交评论