"Reprint" Some of the simplest commands in Oracle sqlplus, setting the format of the display

Source: Internet
Author: User
Tags sqlplus

Log in to the database:

Way (1) when we just installed the Oracle database, login to the account can use Win+r input sqlplus, enter the sqlplus command window, and then enter the user name and password, there will be no echo when you enter the password

Mode (2) Use win+r input cmd, enter the DOS command window, and then enter the user name and password, there will be no echo when entering the password , or use the Direct Input command sqlplus username/password can

After logging in to your account, we can use

Show user to display our current username

If you want to switch users:

Use conn system/admin format as conn username/password

If you want to switch to the SYS account, you need to use CONN sys/admin as Sysdba

Log in to the Scott account now and query the EMP table

Input command: SELECT * from EMP;

Obviously we have overlapping data in the table and the data is malformed.

Using the Format command

(1) Set the length of each line: set linesize length;

Obviously the format is a little bit better than it was before, but our table header shows twice

We can control by setting the size of each page:

(2), set the number of rows per page: Set PAGESIZE number of rows;

It's a good format right now.

In Sqlplus we can use a quick assignment to paste

Right-click the upper part of the form, select Properties---Tick quick edit mode

Then you can use the left mouse button in the command Window to select the command, and then the first time you click the right mouse button is assigned, click again is paste

You can also use Notepad to write commands in Sqlplus.

Using the command: Ed file name, file name without suffix, default is. sql, file

Such as:

In the command window to execute Ed MySQL, because I do not have this file locally, so will be directly popup window prompt, we click OK, we can write, when we write SQL statements in Notepad, Sqlplus is in a blocking state

Sqplus will continue to execute when we save Notepad and then close it.

After writing in Notepad, use the @ file name for execution , and the default file type is. sql

Local commands can also be executed in Sqlplus

Command format: HOST local command;

No demo here

Reprinted from: http://www.cnblogs.com/zqr99/p/7662058.html

"Reprint" Some of the simplest commands in Oracle sqlplus, setting the format of the display

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.