fag oracle 审计_ORACLEPLSQL面试题

OraclePL/SQL

面试题

一、

1-100

之间的素数

declare

fag

boolean:=true;

begin

for

i

in

1..100

loop

for

j

in

2..i-1

loop

if

mod(i,j)=0

then

fag:=false;

end

if;

end

loop;

if

fag

then

dbms_output.put_line(i);

end

if;

fag:=true;

end

loop;

end;

二、

对所有员工

,

如果该员工职位是

MANAGER

,并且在

DALLAS

工作那么就给他薪金加

15

%;如果该员工职位是

CLERK

,并且在

NEW

YORK

工作那么就给他薪金扣除

5

;

其他情况

不作处理

declare

cursor

c1

is

select

*

from

emp;

c1rec

c1%rowtype;

v_loc

varchar2(20);

begin

for

c1rec

in

c1

loop

select

loc

into

v_loc

from

dept

where

deptno

=

c1rec.deptno;

if

c1rec.job

=

'MANAGER'

and

v_loc

=

'DALLAS'

then

update

emp

set

sal

=

sal

*

1.15

where

empno

=

c1rec.empno;

elsif

c1rec.job='CLERK'

and

v_loc

=

'NEW

YORK'

then

update

emp

set

sal

=

sal

*

0.95

where

empno

=

c1rec.empno;

else

null;

end

if;

end

loop;

end;

三、对直接上级是

'BLAKE'

的所有员工,按照参加工作的时间加薪:

81

6

月以前的加薪

10

81

6

月以后的加薪

5

declare

cursor

c1

is

select

*

from

emp

where

mgr

=

(select

empno

from

emp

where

ename='BLAKE');

--

直接上级是

'BLAKE'

的所有员工

c1rec

c1%rowtype;

begin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值