SELECT a.amount + ROUND(a.amount * b.RATE/100,4)
into p_amount
FROM test1 a,test2 b
WHERE a.id = b.id ;如何设置游标b_amount:=0
b_amount=b_amount+p_amount循环去数
into p_amount
FROM test1 a,test2 b
WHERE a.id = b.id ;如何设置游标b_amount:=0
b_amount=b_amount+p_amount循环去数
解决方案 »
- plsql连接服务器的oracle--牛牛们快快出现吧..
- oracle每天定时将查询结果插入指定表,如何实现?
- 跨数据库抽取
- 我的库中有无效对象(函数,过程,视图),编译后,可以通过。但是,隔几天后,又出现了上次的无效对象,不知道是什么原因造成的。
- waiting for the oracle crsd and evmd to start
- 一句SQL语句,请高手指点
- 怎么设置blob字段的存储的大小???????????????
- 请教open_cursor 在线等待!!!
- 请斑竹和专家高手们帮忙
- Oracle 安装 INS-32025
- oracle表类型后面加括号
- 大家帮忙看看,这个触发器为什么无法创建啊
SELECT a.amount + ROUND(a.amount * b.RATE/100,4)
into p_amount
FROM test1 a,test2 b
WHERE a.id = b.id ;如何设置游标
SELECT sum(a.amount + ROUND(a.amount * b.RATE/100,4)) as p_amount
FROM test1 a,test2 b
WHERE a.id = b.id;
By your querys, consult following Oracle function ff_test_l:
create or replace function ff_test_1
return varchar2
is b_amount test1.amount%type;
p_amount test1.amount%type;
sqltext varchar2(2000);
type mycurtype is ref cursor;
cur_l mycurtype;
begin
sqltext := 'SELECT a.amount + ROUND(a.amount * b.RATE/100,4) as p_amount FROM test1 a,test2 b WHERE a.id = b.id';
b_amount := 0;
open cur_l for sqltext;
loop
fetch cur_l into p_amount;
exit when cur_l%notfound;
b_amount := b_amount + p_amount;
end loop;return b_amount;
end ff_test_1;
SELECT a.amount + ROUND(a.amount * b.RATE/100,4)
as p_amount
FROM test1 a,test2 b
WHERE a.id = b.id ;
r_amount c_amount%rowtype;
open c_amount; --//打开游标
loop
fetch c_amount into r_amount ;
exit when c_amount%notfound;
begin
b_amount :=b_amount+r_amount.p_amount;
.......................
exception
...........
end;
end loop;
close c_amount; --//关闭