1.set autot off 禁止使用autotrace命令 set autot on 這個命令包括exp 和 stat(執行語句、生成explain plan、生成統計信息) set autot trace 不執行sql語句,但(生成explain plan、生成統計信息) set autot trace exp stat 與上句同 set autot trace st
1.set autot off 禁止使用autotrace命令
set autot on 這個命令包括exp 和 stat(執行語句、生成explain plan、生成統計信息)
set autot trace 不執行sql語句,但(生成explain plan、生成統計信息)
set autot trace exp stat 與上句同
set autot trace stat 不執行sql語句,但(生成explain plan)
2.序列Sequence_name.nextval 求出接下來的最高值
Sequence_name.currval 最近一次調用nextval時返回的值
3. 創建以10開始的序列create sequence my_sequence start with 10;
查詢序列中接下來的最高值 select my_sequence.nextval from dual;
4. create sequence student_seq;
create table student(n varchar(10));
insert into student values('a'||lpad(student_seq.nextval,9,'0'));
select * from student;
N
----------
a000000002
5. --execute immediate 'set constraints all deferred';
create or replace procedure p is
begin
insert into student values ('a000000004');
insert into student values('a000000005');
insert into student values ('a000000006');
commit;
end p;
6.select * from tab;查看表空間中所有表
7.select * from v$tablespace;查看數據庫中的所有表空間
8.
set serveroutput on
即打開oracle自帶的輸出方法dbms_output。在執行set serveroutput on以后,
使用dbms_output方法可以輸出信息,
例如:dbms_output.put_line('This is mine');
1)創建存儲過程
SQL> set serveroutput on
SQL> create or replace procedure hello IS
2 begin
3 dbms_output.put_line('hello world');
4 end;
5 /
過程已創建。
2)執行存儲過程
SQL> execute hello (或者exec hello)
hello world
PL/SQL 過程已成功完成。
3)刪除存儲過程
SQL> drop procedure hello
2 ;
過程已刪除。
9.SQL*Plus 緩沖區默認大小是20,000字符,最大可以增加到1,000,000字符
SQL> execute dbms_output.enable(1000000);
PL/SQL 過程已成功完成。
將緩沖區的內容保存到文件中
SQL> create or replace procedure hello is
2 begin
3 dbms_output.put_line('hello world,zhang da wang,heihei');
4 end;
過程已創建。
SQL> save hello
已創建 file hello.sql --文件的路徑為:F:\oracle\product\10.2.0\db_1\BIN
SQL> @hello.sql
過程已創建。
SQL> exec hello
hello world,zhang da wang,heihei
PL/SQL 過程已成功完成。
10.賦值操作符“:=”
if條件判斷表達式IF(a=b)
字符串連接操作符“||”
變量聲明區位于IS和BEGIN之間
本文原創發布php中文網,轉載請注明出處,感謝您的尊重!