create or replace function sample_oay(partno string,partnote string) return number is
Result number;
n integer;
begin
--select count(*) into n from dataa146 where part_no like substr(partno,1,8) || '%'
-- and rownum = 1 and part_no <> partno and oay <> 100;
--if n > 0 then
select oay into result from dataa146 where part_no like substr(partno,1,8) || '%'
and rownum = 1 and part_no <> partno and oay <> 100;
--end if;
if result is null then
if instr(upper(partnote),'SAMPLE') > 0 then
result := 50;
else
result := 70;
end if;
end if;
return(Result);
end sample_oay;
Result number;
n integer;
begin
--select count(*) into n from dataa146 where part_no like substr(partno,1,8) || '%'
-- and rownum = 1 and part_no <> partno and oay <> 100;
--if n > 0 then
select oay into result from dataa146 where part_no like substr(partno,1,8) || '%'
and rownum = 1 and part_no <> partno and oay <> 100;
--end if;
if result is null then
if instr(upper(partnote),'SAMPLE') > 0 then
result := 50;
else
result := 70;
end if;
end if;
return(Result);
end sample_oay;
解决方案 »
- 关于SQLP LUS客户端连接问题
- 帮忙解答一个面试题,在线等,有答案马上结贴
- 好急的错误!corruption log header!!!
- oracle for in loop
- 急!!!!!!在线等待!
- 一个查询与数据库更新的问题
- 怎么将表中字符型"29-Jan-76"转成to_date(***,'yyyy-mm-dd')这样?谢谢
- 请问如何向oracle数据库中导入一张嵌套表?
- pl/sql中插入记录的问题。
- 进oracle,提示"oracle 初始化or shutdown in progress"错误,请问是哪儿的原因?在线
- ADO连接oracle数据库,请问怎么样在程序中获取表结构的信息:如各个字段的数据类型,以及其长度,主关键字等..问题有点麻烦,但没分了。.抱歉.
- 调试带返回参数的存储过程时保错!!参数类型或者参数个数错误!怎么回事??
select oay into result from dataa146 where part_no like substr(partno,1,8) || '%'
and rownum = 1 and part_no <> partno and oay <> 100;
执行错误的,必须加表中有无记录的判断
這樣的代碼覺得很沒勁,呵呵。請問lndy在寫類似代碼時都這樣寫嗎,TKS
when no_data_found then
你要做的事情;
Result number;
n integer;
cursor c_test is
select oay from dataa146 where part_no like substr(partno,1,8) || '%'
and rownum = 1 and part_no <> partno and oay <> 100;beginopen c_test;
fetch c_test into result;
if result is null then
if instr(upper(partnote),'SAMPLE') > 0 then
result := 50;
else
result := 70;
end if;
end if;
close c_test;
return(Result);
end sample_oay;