plsql易混知識點

2021-09-09 07:49:06 字數 1015 閱讀 4460

1 、if語句

if a=b then 

處理事務1;

elsif a>b then

處理事務2;

else

處理事務3;

end if;

2、case語句,case語句有兩種情況

(1)case 1

when 3 then 處理事務1;

when 1 then 處理事務2;

else 處理事務3;–此語句非必須

end case;

(2)case

when awhen a=c then 處理事務2;

else 處理事務3;–此語句非必須

end case;

3、insert插入語句,兩種方式

(1)insert into

[column1,…] values (value1,…);

(2)insert into

[column1,…] values subquery;

4、update更新語句,兩種方式

(1)update

set = where ;

(2)update

set (column1,column2,…)=subquery;

5、with關鍵字

with查詢語句不是以select開始的,而是以「with」關鍵字開頭可認為在真正進行查詢之前預先構造了乙個臨時表,之後便可多次使用它做進一步的分析和處理。

with clause方法的優點

增加了sql的易讀性,如果構造了多個子查詢,結構會更清晰;更重要的是:「一次分析,多次使用」,這也是為什麼會提供效能的地方,達到了「少讀」的目標。

第一種使用子查詢的方法表被掃瞄了兩次,而使用with clause方法,表僅被掃瞄一次。這樣可以大大的提高資料分析和查詢的效率。

另外,觀察with clause方法執行計畫,其中「sys_temp_***x」便是在執行過程中構造的中間統計結果臨時表。

PL SQL知識點總結

pl sql基本語法結構 declare declarations statements 宣告乙個變數 begin executable statements 可執行部分 exception exception statements 異常處理部分 end pl sql的資料型別 名稱 型別說明 nu...

C易錯知識點

參考酷客網,對其進行了簡單整理 1 下面的程式並不見得會輸出 hello std out 你知道為什麼嗎?include include intmain return 0 參 stdout 和stderr 是不是同裝置描述符。stdout 是塊裝置,stderr 則不是。對於塊裝置,只有當下面幾種情...

Java 易錯知識點

1 以下程式執行的結果是 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 classx classy publicclasszextendsx publicstaticvoidmain string args zyxx zyxy yxyz xyz...