锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
select * from tb_market_code fetch first 1 rows only
浣嗕笅闈㈣繖縐嶆柟寮忎笉鍏佽
select market_code into v_market_code
from tb_market_code fetch first 1 rows only;
閫夌涓鏉¤褰曠殑瀛楁鍒頒竴涓彉閲忎互浠ヤ笅鏂瑰紡浠f浛
declare v_market_code char(1);
declare cursor1 cursor for select market_code from tb_market_code
fetch first 1 rows only for update;
open cursor1;
fetch cursor1 into v_market_code;
close cursor1;
2銆亀hile銆乮f鍜寃hen鍦扮敤娉?
while v_notfound=0 Do
set v_notfound=1;
fetch cursor1 into v_market_code;
end while;
if(鎴杦hen) v_notfound=0 then
set v_notfound=1;
fetch cursor1 into v_market_code;
end if;
3銆佺被浼糲harindex鏌ユ壘瀛楃鍦ㄥ瓧涓蹭腑鐨勪綅緗?
Locate(‘y’,’dfdasfay’)
鏌ユ壘’y’ 鍦?/span>’dfdasfay’涓殑浣嶇疆銆?/span>
4銆?綾諱技datedif璁$畻涓や釜鏃ユ湡鐨勭浉宸ぉ鏁?u>
days(date(‘
days 榪斿洖鐨勬槸浠?/span>
5銆?棰勯槻瀛楁絀哄肩殑澶勭悊
SELECT DEPTNO ,DEPTNAME ,COALESCE(MGRNO ,'ABSENT'),ADMRDEPT
FROM DEPARTMENT
COALESCE鍑芥暟榪斿洖()涓〃杈懼紡鍒楄〃涓涓涓笉涓虹┖鐨勮〃杈懼紡錛屽彲浠ュ甫澶氫釜琛ㄨ揪寮忋?/span>
鍜?/span>sqlserver鐨?/span>isnull綾諱技錛屼絾isnull濂借薄鍙兘涓や釜琛ㄨ揪寮忥紱oracle涓?/span>NVL銆?/span>
6銆佸彇寰楀鐞嗙殑璁板綍鏁?
declare v_count int;
update tb_test set t1=’
where t2=’
--媯鏌ヤ慨鏀圭殑琛屾暟,鍒ゆ柇鎸囧畾鐨勮褰曟槸鍚﹀瓨鍦?/span>
get diagnostics v_ count=ROW_COUNT;
鍙update,insert,delete璧蜂綔鐢?/span>.
涓嶅select into 鏈夋晥
7銆?綾誨瀷杞崲鍑芥暟
select cast ( current time as char(8)) from tb_market_code
8銆?values鐨勪嬌鐢?
濡傛灉鏈夊涓?/span> set 璇彞緇欏彉閲忎粯鍊鹼紝鏈濂戒嬌鐢?/span>values璇彞錛屾敼鍐欎負涓鍙ャ傝繖鏍峰彲浠ユ彁楂樻晥鐜囥?/span>
浣嗚娉ㄦ剰錛?/span>values涓嶈兘灝?/span>null鍊間粯緇欎竴涓彉閲忋?/span>
values(null) into out_return_code;
榪欎釜璇彞浼氭姤閿欑殑銆?/span>