34,590
社区成员
发帖
与我相关
我的任务
分享
create or replace procedure 各仓库各物料存储数量(仓库号 in 仓库.仓库编号%type)
is
仓库名 仓库.仓库名称%type;
物料号 物料.物料编号%type;
物料数 仓库.物料数量%type;
begin
dbms_output.put_line('仓库名称'||', '||'物料名称'||', '||'物料数量');
SELECT 仓库编号,物料编号,物料数量 into 仓库名,物料号,物料数 from 仓库 where 仓库编号=仓库号;
dbms_output.put_line(仓库名||','||物料号||','||','||物料数);
end;
create or replace procedure 各仓库各物料存储数量(仓库号 in 仓库.仓库编号%type)
is
仓库名 仓库.仓库名称%type;
物料号 物料.物料编号%type;
物料数 仓库.物料数量%type;
begin
dbms_output.put_line('仓库名称'||', '||'物料名称'||', '||'物料数量');
SELECT 仓库编号,物料编号,sum(物料数量) into 仓库名,物料号,物料数 from 仓库 where 仓库编号=仓库号 group by 仓库编号;
dbms_output.put_line(仓库名||','||物料号||','||','||物料数);
end;
报错不是group by 表达式SELECT 仓库编号 ,
物料编号 ,
物料数量
FROM 仓库
SELECT 仓库编号 ,
SUM(物料数量) AS 总数量
FROM 仓库
GROUP BY 仓库编号
CREATE PROC dbo.test
AS
BEGIN
SELECT 仓库编号 ,
物料编号 ,
SUM(物料数量) AS 总物料数量
FROM 仓库
GROUP BY 仓库编号 ,
物料编号
END
GO
create or replace procedure 各仓库物料存储数量
is
仓库号 仓库.仓库编号%type;
物料号 物料.物料编号%type;
物料数 仓库.物料数量%type;
cursor mycur--(仓库号 in 仓库.仓库编号%type)
is SELECT 仓库编号,物料编号,物料数量 from 仓库;-- where 仓库编号=仓库号;
begin
--if mycur%isopen=false
--then
open mycur;
--end if;
dbms_output.put_line('仓库编号'||', '||'物料编号'||', '||'物料数量');
loop
fetch mycur into 仓库号,物料号,物料数;
exit when mycur%notfound;
dbms_output.put_line(仓库号||','||物料号||','||物料数);
end loop;
close mycur;
end;
select *From VW_ServiceReg where Machine_NO='00FK661J31EYMC'