Oracle command collation

1 Common commands

1

Do not add after sqlplus scott/[email protected]:1521/orcl       ;

 

sqlplus sys/oracle as sysdba [password authentication]

 

sqlplus   username is arbitrary/password is arbitrary  as sysdba [host authentication]

2

spool d:\Basic query.txt Screen recording starts

 

spool off screen recording ends

3

show user View current user

 

select * from tab; view all tables under the current user

 

desc table name View the structure of the table

4

show  linesize           

 

set    linesize 200

 

show  pagesize   

 

set pagesize 30 Set the number of records displayed per page

 

col column name for a8 set column width for is the abbreviation of format

 

col column name for 9999 set the column width 9 means one digit 9999 means four digits

5

clear screen under host cls windows

 

host clear to clear the screen under Linux

6

ed pops up notepad to write the previous code edit abbreviation

 

c abbreviation for command change

            Usage :

            1 Enter the line number to be modified

            2 c/original content/modified new content

 

/ execute the currently edited command

7

nvl(a,b) a is not null equal to a, a is null equal to b

 

nvl2(a,b,c) returns c when a=null, otherwise returns b

 

nullif(a,b) When a and b are equal, return null, otherwise return a

 

coalesce finds the first non-null value from left to right

8

select userenv('language') from dual; View server code

 

select * from V$NLS_PARAMETERS; view the value of the parameter

 

NLS_LANG      AMERICAN_AMERICA.ZHS16GBK environment variable

9

http://192.168.47.10:5560/isqlplus/   browser to open isqlplus

 

http://192.168.47.10:1158/em/     browser open OEM

10

break on deptno skip 2 The same column is displayed once, and two rows are skipped between different groups

 

break on null cancels the setting named in item 26

11

set timing on turns on statement execution time display

 

set timing off turns off the display of statement execution time

12

set feedback off closes the reminder after each statement execution For example: 1 row has been inserted

 

set feedback on

13

@d:\temp\testdelete.sql Execute the script file in the specified directory

14

savepoint a; create a savepoint

 

rollback to savepoint a; return to the specified savepoint

 

commit;

 

rollback;

15

set transaction read only; set the isolation level

16

wm_concat(varchar2)          多行函数  行转列

 

concat(char1,char2)       || 

17

show recyclebin;              查看回收站

 

purge recyclebin;             清空回收站

 

flashback  table 表名 to before drop;         从回收站恢复

 

drop  table 表名 purge;      彻底删除,不进入回收站

 

select  * from 回收站的表名【RECYCLEBIN NAME】;

 

注意:管理员没有回收站,回收站只针对普通用户

18

grant  create view to scott;         授予创建视图的权限

 

grant  select on hr.employees  to  scott;

 

grant  create  synonym  to scott;

 

grant  create  tablespace to scott;

19

--SQL的执行计划

 

explain plan for select * from emp where deptno=10;

20

查看数据库的版本

 

SELECT version

FROM product_component_version

WHERE substr(product, 1, 6) = 'Oracle';

21

 

 

查询星期几中文显示

 

select to_char(sysdate,'day','NLS_DATE_LANGUAGE=''SIMPLIFIED CHINESE''') from dual;

22

alter session set NLS_DATE_LANGUAGE='SIMPLIFIED CHINESE';

 

alter session set NLS_DATE_FORMAT='yyyy-mm-dd';

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324616050&siteId=291194637