Oracle Series: (4) Oracle Readiness Knowledge 2

Source: Internet
Author: User
Tags clear screen



1, ordinary users to modify their own password

Use the password command to modify the new password for the Scott user name, beginning with a letter, but advocating the use of tiger

Password old password: Tiger new password: abc123 Enter the new password again: abc123


2. Exit Sqlplus Tool

Exit


3. Query who is the current user

Show user;


4. Query all objects under the Scott user

Using the tab table, the tab table is available for each user

SELECT * from tab;


5. Set the displayed column width

(1) Set the width of the display ( character varchar2, date type of day), 10 widths, a for the character type, and case can be

column ename format A12;

Column HireDate format A10;


(2) Set the displayed column width ( numericnumber), 9 for the numeric type, one 9 for a digit bit, four 9 for four digits, and only 9

column empno format 9999;

Column MGR format 9999;

Column SAL format 9999;

Column Comm format 9999;

Column DEPTNO format 9999;


650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/86/EE/wKiom1fO8KnTjVfIAAAQ1zq2vU8645.png "title=" 001. PNG "alt=" Wkiom1fo8kntjvfiaaaq1zq2vu8645.png "/>


6, set a page to show the height of 80 records

Set pagesize 80;


7, use/Slash, execute the last SQL statement

/


8, clear screen, belong to the Sql*plus tool in the command

Host CLS;


9, query the structure of the EMP table

DESC EMP;

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/86/EE/wKiom1fO8t_i6C5xAAAWJ2nsm5Q612.png "title=" 003. PNG "alt=" Wkiom1fo8t_i6c5xaaawj2nsm5q612.png "/>


10. Create a new table based on existing tables

--Create a new table new_emp, copy the structure and data from the EMP table into the New_emp table ( Note: Do not omitas)

CREATE TABLE Copy_emp as SELECT * from EMP;

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/86/EE/wKiom1fO8jOgJ6eLAAAYqh7d13c349.png "title=" 002. PNG "alt=" Wkiom1fo8jogj6elaaayqh7d13c349.png "/>


11. Output SQL statements to a file and read SQL from a file

Using the spool command, save the SQL statement to the hard disk file E:/oracle-day01.sql, and create the SQL file

Spool E:/oracle-day01.sql;


Using the spool off command, save the SQL statement to the hard disk file E:/oracle-day01.sql, and create the SQL file, concluding sentence

Spool off;

It outputs both SQL statements and query results to a file


Use the @ command to e:/crm.sql the hard disk file, read the ORCL instance, and execute the SQL statement in the file

@ e:/crm.sql;


12. Comments

Use--symbol to set a single line comment

--select * from EMP;


Set multiple lines of comments using the/* */Sign

/*select*from emp;*/

Summary: In all the techniques learned, the notation about annotations


//

/* */

html <!--...--;
css /* comments */
js

// 

/* Comment */

xml <!--comment-->
jsp <%--comment--%>
mysql

-- 

/* Comment */

Reference:/HTTP/ www.cnblogs.com/end/archive/2011/03/31/2001109.html

oracle

--

/* */

java


Oracle Series: (4) Oracle Readiness Knowledge 2

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.