Oracle SQL脚本学习记录一
生活随笔
收集整理的這篇文章主要介紹了
Oracle SQL脚本学习记录一
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
2019獨角獸企業(yè)重金招聘Python工程師標準>>>
set?serveroutput?on declare v_age?number; begin v_age:=12; v_age:=v_age/0; exception when?ZERO_DIVIDE?then dbms_output.put_line(‘divde?by?zero’); end; declare v_name?varchar2(10); begin v_name:=’wmsjhappy’; DBMS_OUTPUT.PUT_LINE(v_name); end; / declare? begin? select?*?from?tb_personresumes; end; / ——————————————————————————————————————- create?table?protest?(name?varchar2(10),pass?varchar2(10)); insert?into?protest?values?(‘wmsjhappy’,’20070701′); select?*?from?protest; commit; CREATE?or?replace?procedure?sp_proUserInfo(sApName?varchar2,sApPass?varchar2)?is begin update?protest?set?name=sapname,pass=sappass; end; commit; call?sp_proUserInfo(‘diwaycom’,'radius’); exec?sp_proUserInfo(‘diway’,'radius’); select?*?from?protest; commit; select?*?from?protest; DECLARE CURSOR?c1?IS SELECT?prod_id,?cust_id,?time_id,?amount_sold? FROM?sales WHERE?amount_sold?>?100; c1_rec?c1%rowtype; l_cust_first_name?customers.cust_first_name%TYPE; l_cust_lasT_name?customers.cust_last_name%TYPE; BEGIN FOR?c1_rec?IN?c1 LOOP –?Query?customer?details SELECT?cust_first_name,?cust_last_name INTO?l_cust_first_name,?l_cust_last_name FROM?customers WHERE?cust_id=c1_rec.cust_id; – –?Insert?in?to?target?table – INSERT?INTO?top_sales_customers?( prod_id,?cust_id,?time_id,?cust_first_name,?cust_last_name,amount_sold ) VALUES ( c1_rec.prod_id, c1_rec.cust_id, c1_rec.time_id, l_cust_first_name, l_cust_last_name, c1_rec.amount_sold ); END?LOOP; COMMIT; END; create?table?protest(name?varchar2(10),pass?varchar2(10)); set?serveroutput?on; declare?cursor?get_date?isselect?name,pass?from?protest; beginfor?i?in?get_dateloopDBMS_OUTPUT.PUT_LINE(‘name:?‘||i.name||’???pass:?‘||i.pass);end?loop; end; / L>?declare????????????????????????????????????????????????????????????????????????????????????????cursor?t?is????????????????????????????????????????????????????????????????????????????????????select?susername?from?tbl_usersagentgoogle;????????????????????????????????????????????????????tname?t%rowtype;???????????????????????????????????????????????????????????????????????????????begin??????????????????????????????????????????????????????????????????????????????????????????????for?tname?in?t?????????????????????????????????????????????????????????????????????????????????loop???????????????????????????????????????????????????????????????????????????????????????????select?susername?into?tname?from?tbl_usersagentgoogle;?????????????????????????????????????????end?loop;??????????????????????????????????????????????????????????????????????????????????end;??????????????????????????????????????????????????????????????????????????????????????????/轉載于:https://my.oschina.net/wmsjhappy/blog/272551
總結
以上是生活随笔為你收集整理的Oracle SQL脚本学习记录一的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 哪种春季时令食物有树上蔬菜之称?蚂蚁庄园
- 下一篇: 韩国2月芯片出口暴跌43.9%:三星、S