| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1410 人关注过本帖
标题:看看我写的程序包那里错了
只看楼主 加入收藏
毛蛋
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-5-30
收藏
 问题点数:0 回复次数:1 
看看我写的程序包那里错了
表my_toys
id  varchar2(5)
name varchar2(20)
price  number

create or replace package body toyspack
  as
  procedure UpdateToyPrice IS
  avg_price number;
  fact_price number;
begin
  loop
  SELECT AVG(price),price INTO avg_price,fact_price FROM my_toys;
    if avg_price<400 then
       update my_toys set price=price*1.1 where price<=500;
    else
       exit;
    end if;
  end loop;
  end UpdateToyPrice;          ----------------过程结束
  function AvgToyPrice       ----------------函数开始
    return varchar2
  IS
    avg_price number;
    fact_price number;
  begin
   loop
     SELECT AVG(price),price INTO avg_price,fact_price FROM my_toys;
     if avg_price<400 then
        update my_toys set price=price*1.1 where price<=500;
     else
        return '函数执行完成!';
     end if;
    end loop;
  end AvgToyPrice;
end toyspack;
/
搜索更多相关主题的帖子: 程序包 
2008-03-24 19:00
快速回复:看看我写的程序包那里错了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.044425 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved