国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開(kāi)發(fā) > 綜合 > 正文

幾十個(gè)實(shí)用的PL/SQL(2)

2024-07-21 02:08:01
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

商業(yè)源碼熱門(mén)下載www.html.org.cn


 

第二階段

q.編寫(xiě)一個(gè)pl/sql程序塊,對(duì)名字以“a”或“s”開(kāi)始的所有雇員按他們的基本薪水的10%加薪。

a.

declare

       cursor c1 is

          select * from emp where substr(ename,1,1)='a' or substr(ename,1,1)='s' for update of sal;

 

begin

       for i in c1

       loop

              update emp set sal=nvl(sal,0)+nvl(sal,0)*0.1 where current of c1;

       end loop;

end;

/

q.編寫(xiě)一pl/sql,對(duì)所有的“銷(xiāo)售員”(salesman)增加傭金500.

a.

declare

       cursor c1 is

          select * from emp where job='salesman' for update of sal;

begin

       for i in c1

       loop

              update emp set sal=nvl(sal,0)+500 where current of c1;

       end loop;

end;

/

q.編寫(xiě)一pl/sql,以提升兩個(gè)資格最老的“職員”為“高級(jí)職員”。(工作時(shí)間越長(zhǎng),優(yōu)先級(jí)越高)

a.

declare

       cursor c1 is

          select * from emp where job='clerk' order by hiredate for update of job;

          --升序排列,工齡長(zhǎng)的在前面

 

begin

       for i in c1

       loop

              exit when c1%rowcount>2;

              dbms_output.put_line(i.ename);

              update emp set job='highclerk' where current of c1;

       end loop;

end;

/

q.編寫(xiě)一pl/sql,對(duì)所有雇員按他們基本薪水的10%加薪,如果所增加的薪水大于5000,則取消加薪。

a.

declare

       cursor c1 is select * from emp  for update of sal;

 

begin

       for i in c1

       loop

             

              if (i.sal+i.sal*0.1)<=5000 then

                     update emp set sal=sal+sal*0.1 where current of c1;

                     dbms_output.put_line(i.sal);

              end if;

             

       end loop;

end;

/

q.顯示emp中的第四條記錄。

a.

declare

       cursor c1 is select * from emp;

 

begin

       for i in c1

       loop

              if c1%rowcount=4 then

                     dbms_output.put_line(i. empno || ' ' ||i.ename ||  ' ' || i.job ||  ' ' || i.mgr || ' ' || i.hiredate || ' ' || i.sal || ' ' || i.comm  || ' ' || i.deptno);

                     exit;

              end if;

       end loop;

end;

/
發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 桐梓县| 卢氏县| 安新县| 遂溪县| 景德镇市| 邢台县| 原阳县| 乃东县| 辉县市| 玉溪市| 尉犁县| 谢通门县| 康保县| 松潘县| 安庆市| 翁牛特旗| 象山县| 平陆县| 威远县| 铅山县| 昌平区| 闸北区| 昌乐县| 桂东县| 浪卡子县| 屏东县| 西吉县| 盐津县| 丹寨县| 北碚区| 汶上县| 西乌珠穆沁旗| 陆良县| 博客| 定西市| 和平区| 本溪| 龙泉市| 泾源县| 库尔勒市| 奉贤区|