⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp_medicinestockfindamount.sql

📁 Delphi6开发的HIS程序
💻 SQL
字号:

create or replace function sp_medicinestockfindamount(l_medicinestockid in integer)
  return number is
  l_medicinestockdetailid integer;
  l_count                 integer;
  l_amount                number(16,
                                 4);
begin
  select count(*)
  into   l_count
  from   medicinestockdetail
  where  medicinestockid = l_medicinestockid and amount > 0;

  if l_count = 0 then
    return - 1;
  end if;

  select min(medicinestockdetailid)
  into   l_medicinestockdetailid
  from   medicinestockdetail
  where  medicinestockid = l_medicinestockid and amount > 0;

  select amount
  into   l_amount
  from   medicinestockdetail
  where  medicinestockdetailid = l_medicinestockdetailid;

  return l_amount;
end;
/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -