sqlplus small secret (a)
SQL> set serveroutput on
SQL> exec dbms_output.put_line ( 'abc');
abc
PL / SQL procedure successfully completed.
(I had a very distressed in order to retain the space, try to increase "." Characters, such as additional ways not visible, but ultimately felt that it was not natural)
In fact, as long as the set serveroutput on after format wrapped parameters, this problem could be avoided
SQL> set serveroutput on format wrapped
SQL> exec dbms_output.put_line ( 'abc');
abc
PL / SQL procedure successfully completed.
=========================================
Sql * plus, the sql statement does not allow intermediate time, one copy from the other parts of the script to run sql * plus very trouble. For example, the following script:
select deptno, empno, ename
from emp
where empno ='7788 ';
If the copy to run sql * plus, there will be an error:
SQL> select deptno, empno, ename
from emp
where empno ='7788 '; 2 3 SQL>
SP2-0734: unknown command beginning "where empn ..." - rest of line ignored.
The reason is that blank lines on sqlplus encountered is considered the end of the statement.
To change this phenomenon in a matter of fact, as long as the parameters used SQLBLANKLINES it.
SQL> set sqlblanklines on
SQL> select deptno, empno, ename
from emp
where empno ='7788 '; 2 3 4
DEPTNO EMPNO ENAME
---------- ---------- ----------
20 7788 SCOTT
=======================================
Is there any such experience? In sql * plus in a very long out of order, suddenly found out the name of a recall, if the abolition of the current command, and then re-query out to be too painful. Of course, you can open a sql * plus query window, but the method here is simpler.
For example, you want to search more than 4,000 employees wage information, enter the following statement:
SQL> select empno
2, ename
At this time, you discover that your wages can not remember what the column names.
Under the circumstances, as long as a # at the beginning of the next line, you can implement a sql * plus command, the Executive after the statement just to continue the importation of
SQL> select empno
2, ename
3 # desc emp
Name Null? Type
----------------------------------------- -------- -- ---------------------------
EMPNO NOT NULL NUMBER (4)
ENAME VARCHAR2 (10)
JOB VARCHAR2 (9)
MGR NUMBER (4)
HIREDATE DATE
SAL NUMBER (7,2)
COMM NUMBER (7,2)
DEPTNO NUMBER (2)
3, job, sal from emp where sal> 4000
4 /
EMPNO ENAME JOB SAL
---------- ---------- --------- ----------
7839 KING PRESIDENT 5000
Related Posts of sqlplus small secret (a)
-
char, varchar2 difference
Distinction: rn 1. CHAR is fixed length, and the length of VARCHAR2 is changing, for example, store the string "abc", for CHARrn (20), that you will store the 20-byte characters (including null character 17), and the same VARCHAR2rn (20) oc ...
-
SQLPlus skills
SQLPlus skills 1. The use of dynamically generated SQL * PLUS script volume Spool command will be combined with the use of select, you can generate a script, the script may have included the implementation of a bulk of the mission statement. Example ...
-
RMAN created physical standby
Monitor in the standby host to create the necessary directory structure and parameter files. Hot COPY after the main library to the standby, and on standby to restore. +++++++++++++++++++++++++++++ Standby ++++++++++++++++++++++++++++++++++++++++++++ ...
-
ProC will select the data on the two-dimensional array
Examples are as follows: (Over)
-
Oracle locking mechanism (reprint)
Blocking mechanism is set up in order to control the concurrent operation of the block interference, to ensure data consistency and accuracy. Oracle database blockade There are three ways: sharing blockade blockade exclusive, shared update blockade [ ...
-
Turning optimization oracle article
DB_BLOCK_LRU_LATCHES = 6 BUFFER_POOL_KEEP = (BUFFERS: 14000, LRU_LATCHES: 1) BUFFER_POOL_RECYCLE = (BUFFERS: 2000, LRU_LATCHES: 3) ... Note: buffer_pool_buffers = 2000 * 3 +14000 * 1 = 20000 keep the district will once again be used to retain the use ...
-
An example of the use of TKPROF
First, view and edit parameters SQL> show parameter max_dump_file_size NAME TYPE VALUE ------------------------------------ ----------- --- --------------------------- max_dump_file_size string UNLIMITED SQL> show parameter user_dump_dest NAME TYPE













Leave a Reply