1
create
or
replace
procedure
upstat(tablename
in
varchar2
,
2 orderservid in varchar2 ,
3 table_num in number ,
4 status in number ) is
5 i number ( 4 , 0 );
6 smstable varchar2 ( 32 );
7 update_sql varchar2 ( 500 );
8 begin
9 i : = 0 ;
10 while i < table_num loop
11 if (i >= 10 ) then
12 smstable : = ' SMS_USER_0 ' || to_char(i);
13 else
14 smstable : = ' SMS_USER_00 ' || to_char(i);
15 end if ;
16 update_sql : = ' update ' || smstable || ' t set t.status= ' || status || '
17 where t.orderservid= ''' || orderservid ||
18 ''' and exists (select '' x '' from ' || tablename ||
19 ' b where b.ms = t.mobileno) ' ;
20 DBMS_OUTPUT.put_line(update_sql);
21 -- execute immediate update_sql;
22 commit ;
23 i : = i + 1 ;
24 end loop;
25 end upstat;
2 orderservid in varchar2 ,
3 table_num in number ,
4 status in number ) is
5 i number ( 4 , 0 );
6 smstable varchar2 ( 32 );
7 update_sql varchar2 ( 500 );
8 begin
9 i : = 0 ;
10 while i < table_num loop
11 if (i >= 10 ) then
12 smstable : = ' SMS_USER_0 ' || to_char(i);
13 else
14 smstable : = ' SMS_USER_00 ' || to_char(i);
15 end if ;
16 update_sql : = ' update ' || smstable || ' t set t.status= ' || status || '
17 where t.orderservid= ''' || orderservid ||
18 ''' and exists (select '' x '' from ' || tablename ||
19 ' b where b.ms = t.mobileno) ' ;
20 DBMS_OUTPUT.put_line(update_sql);
21 -- execute immediate update_sql;
22 commit ;
23 i : = i + 1 ;
24 end loop;
25 end upstat;