2005-2-2 10:37
ground
CREATE OR REPLACE PROCEDURE <span style='color:red'>important</span> AS <br />brand_id number; <br />BEGIN <br />for counter in 1..6 loop <br /> for tmpVar in 1..8 loop <br /> select brand into brand_id from tt5 where brand=tmpVar and county_id=counter; <br /> if brand_id is null <br /> then <span style='color:red'>insert into tt5 select '',counter,tmpVar,0,0 from dual;</span> <br /> end if; <br /> end loop; <br />end loop; <br />END important; <br />编译通过,运行是出错:<br />no data found ,应该是第一个select 语句无返回值,直接退出整个过程了。<br />但是我想继续运行,而且我也用了判断语句--也就是这个语句:if brand_id is null then<br />怎么能继续运行不退出循环啊??<br /><br />
2005-2-3 20:33
无双
存储过程啊 没用过<br />找seven看看<br />他数据库还是很精通的 <br /><br />good luck
2005-2-4 16:41
ground
谢谢无双!<br />seven在哪儿啊,给我个群也行啊,平时不关心oracle ,唉,早加oracle群好了。<br />啊,无双新年快乐!<br />论坛里的所有兄弟姊妹,新年快乐!
2005-2-17 00:05
kenliao
try this one.<br /><br />CREATE OR REPLACE PROCEDURE important AS <br /> brand_id number; <br />BEGIN <br /> for counter in 1..6 loop <br /> for tmpVar in 1..8 loop <br /> select brand into brand_id from tt5 where brand=tmpVar and county_id=counter;<br /> end loop; <br /> end loop; <br />EXCEPTION<br /> WHEN NO_DATA_FOUND THEN<br /> insert into tt5 select '',counter,tmpVar,0,0 from dual;<br />END important;
2005-3-17 08:50
ground
谢谢弟兄们!
页:
[1]
Powered by Discuz! Archiver 5.5.0
© 2001-2006 Comsenz Inc.