永发信息网

请教oracle一个存储过程的写法

答案:3  悬赏:0  手机版
解决时间 2021-01-30 23:33
  • 提问者网友:美人性情
  • 2021-01-30 11:51
我这里有一个SqlServer2005的存储过程
CREATE or replace PROCEDURE fun_xsreMobile
(
paR_intInterID_c int,
paR_lngMobile_c numeric,
Date_c numeric
)
AS

Select Top 1 ID, CpID, MobState, Settled, SendDate, ReceCount, IsLocked, GateID, ExtData,ReceTs From xsreMobile where InterID =paR_intInterID_c and Mobile =paR_lngMobile_c and SendDate >=Date_c

我现在想把它改成oracle的存储过程,请问应该怎么改,谁帮我改一下啊,谢谢了。

就是一个存储过程,里面是这条查询语句,根据输入的参数进行查询,将查询的结果显示出来
最佳答案
  • 五星知识达人网友:人類模型
  • 2021-01-30 12:52
CREATE or replace PROCEDURE fun_xsreMobile
(
paR_intInterID_c int,
paR_lngMobile_c number,
Date_c number
)
is
--定义变量
begin

Select ID,
CpID,
MobState,
Settled,
SendDate,
ReceCount,
IsLocked,
GateID,
ExtData,
ReceTs
--into 到变量
From xsreMobile
where InterID = paR_intInterID_c
and Mobile = paR_lngMobile_c
and SendDate >= Date_c
and rownum<=1;

end fun_xsreMobile;
全部回答
  • 1楼网友:你哪知我潦倒为你
  • 2021-01-30 15:11
一条sql搞定 select citizenid_number,ltrim(max(sys_connect_by_path(name,',')),',') from( select citizenid_number,name,row_number() over(partition by citizenid_number order by citizenid_number) citizenid_number1, row_number() over(order by citizenid_number) + dense_rank() over(order by citizenid_number) citizenid_number2 from 表 ) start with citizenid_number1=1 connect by prior citizenid_number2 = citizenid_number2 -1 group by citizenid_number order by citizenid_number; 你的编号对应 citizenid_number 物品名称对应name 没写用途名称 自己研究加上就是了
  • 2楼网友:刀戟声无边
  • 2021-01-30 13:54
貌似没写全吧,select应该后边跟into 变量 top 1 改成 where rownum<=1 其他的没多大变化,还有numeric改成number类型 ---补充--- CREATE or replace PROCEDURE fun_xsreMobile ( paR_intInterID_c in int, paR_lngMobile_c in number, Date_c in number ) is v_ID; v_CpID; v_MobState; v_Settled; v_SendDate; v_ReceCount; v_IsLocked; v_GateID; v_ExtData; v_ReceTs; CURSOR cur_1 is Select ID, CpID, MobState, Settled, SendDate, ReceCount, IsLocked, GateID, ExtData,ReceTs From xsreMobile where InterID =paR_intInterID_c and Mobile =paR_lngMobile_c and SendDate >=Date_c where rownum<=1; begin open cur_1; loop fetch cur_1 into v_ID, v_CpID, v_MobState, v_Settled, v_SendDate, v_ReceCount, v_IsLocked, v_GateID, v_ExtData, v_ReceTs exit when cur_1%notfound; dbms_output.put_line(v_ID||',' ||v_CpID||',' ||v_MobState||','||v_Settled||','||v_SendDate||','||v_ReceCount||',' ||v_IsLocked||',' ||v_GateID||',' ||v_ExtData); end loop; close cur_1; end;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯