Tips for SQL * Plus commands

Source: Internet
Author: User

SQL * Plus command tip 1: SQL * Plus command to bind a variable to operate www.2cto.com SQL> var job varchar2 (20) SQL> exec: job: = 'sh _ cler' PL/SQL procedure successfully completed. SQL> select job_id, employee_id from emp where job_id =: job; SQL> print jobJOB 1_sh_clerk 2, displaying the size of the row and page variables www.2cto.com SQL> SHOW linesize pagesizelinesize 80 pagesize 143, set 80 characters for each line and 26 rows for each page> Set linesize 80 pagesize 26 4. When "&" is set, the "&" character is treated as a variable in the default SQL * Plus environment, in some cases, you also need to enter '& characters' under the SQL> symbol. You only need to change the SQL * Plus environment variable define. View the define status of the current SQL * Plus: SQL> SHOW define; the default & Variable binding function is canceled, and '& characters' can be treated as common characters. SQL> SET define off; Enable & bind the variable function, and use the string following & as a variable. SQL> SET define on; 5. SET the delimiter between columns SQL> show colsepcolsep "" SQL> select employee_id, job_id from emp where rownum <4; EMPLOYEE_ID JOB_ID ----------- -------- 198 SH_CLERK 199 SH_CLERK 200 AD_ASSTSQL> set colsep | SQL> show colsepcolsep "|" SQL> select employee_id, job_id from emp where rownum <4; EMPLOYEE_ID | JOB_ID ----------- | ---------- 198 | SH_CLERK 199 | SH_CLERK 200 | AD_ASST6, set whether to display the column title SQL> show headingheading ONSQL> set heading offSQL> select employee_id, job_id from emp where rownum <4; 198 | SH_CLERK 199 | SH_CLERK 200 | AD_ASSTSQL> set heading onSQL> select employee_id, job_id from emp where rownum <4; EMPLOYEE_ID | JOB_ID ----------- | ---------- 198 | SH_CLERK 199 | SH_CLERK 200 | AD_ASST www.2cto.com 7, set the system time to display SQL> set time on04: 17: 13. SQL> set timing on: displays the SQL statement execution time 8, save all set SQL environment variable values in a script file SQL> store set/home/oracle/myScripts/sqlset. sqlCreated file/home/oracle/myScripts/sqlset. sql9, Oracle FORMAT usage SQL> col job_id format a20SQL> col salary format syntax> select department_id, job_id, salary from emp where rownum <2; DEPARTMENT_ID JOB_ID SALARY limit ------------- 50 SH_CLERK 2600.00

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.