学习oracle技术,每天学一点,每天进步一点

生成有规则的用户名和随机产生的对应6位用户数字密码

上一篇 / 下一篇  2007-12-26 16:21:42 / 个人分类:pl/sql

begin
WbG*eI%}0for i in 1..5000 loopITPUB个人空间4Y'xSE0?E1a-AS"oC
if i<10 then
d|0H2I,bIn9G0insert into tb_test (role_id,name,login,password,credit_amount,currency_code_id)
T-Xxok2|.kPV0values(4,'ddz0000'||i,'ddz0000'||i,TRUNC(DBMS_RANDOM.VALUE(100000, 999999)),50000,156);ITPUB个人空间3\L1vT9N(~3N _]
elsif i>=10 and i<100 then
/e"gNfZs(Y0insert into tb_test (role_id,name,login,password,credit_amount,currency_code_id)ITPUB个人空间m'Y` d*wD
values(4,'ddz000'||i,'ddz000'||i,TRUNC(DBMS_RANDOM.VALUE(100000, 999999)),50000,156);ITPUB个人空间2Z!M#cH YMA$i0U9T5{$b
elsif i>=100 and i<1000 then
-o;i(]Ix x0insert into tb_test (role_id,name,login,password,credit_amount,currency_code_id)
EkvrJ@0values(4,'ddz00'||i,'ddz00'||i,TRUNC(DBMS_RANDOM.VALUE(100000, 999999)),50000,156);
T/E-f yi(C*N!V0elsif i>=1000 and i<=5000 thenITPUB个人空间u.Y"xQUo
insert into tb_test (role_id,name,login,password,credit_amount,currency_code_id)ITPUB个人空间4FkU}SW)V%Sq W,n
values(4,'ddz0'||i,'ddz0'||i,TRUNC(DBMS_RANDOM.VALUE(100000, 999999)),50000,156);
+Bg.xr7VDMK O0end if;
;l bvmNw0end loop;ITPUB个人空间 _ [iO:Gq
commit;ITPUB个人空间7fx8I$`6Wv#Y
end;ITPUB个人空间2j$FV,DX_C!eQ

)c6[`w)J0select TRUNC(DBMS_RANDOM.VALUE(100000, 999999) from dual;ITPUB个人空间/w"Y th\tI"D+Y
会产生100000,999999之间的6位数字,所以就达到了随机产生6位用户数字密码的功能ITPUB个人空间cI9vf3N
备注:以上语句是用oracle 的pl/sql 语法


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-08-30  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

数据统计

  • 访问量: 15402
  • 日志数: 276
  • 图片数: 2
  • 建立时间: 2007-12-11
  • 更新时间: 2008-08-29

RSS订阅

Open Toolbar