"Statistics Merchant 24 months continuous running total number of months stored procedures"
To Delete a stored procedure
sql> drop procedure Checklen;
Procedure dropped
create a stored procedure
sql> CREATE OR REPLACE PROCEDURE Checklen (val in varchar2,resultval out number) as
maxlen number;
Nowlen number;
begin
MaxLen: = 0;
Nowlen: = 0;
For i in 1..24 loop
if substr (val,i,1) = ' 0 ' then
Nowlen: = 0;
Else
Nowlen: = Nowlen + 1;
if Nowlen>maxlen then
maxlen: = Nowlen;
End If;
End If;
end Loop;
resultval: = MaxLen;
END;
/
turn on the screen output
set serveroutput on;
Test Stored Procedures
Declare
resultval number;
begin
Checklen (' 111000000000000000011110 ', resultval);
Dbms_output.put_line (resultval);
end;
/
4
PL/SQL procedure successfully completed
Liucheng leonarding
2016.1.14
Beijing &winter
Sharing Technology ~ Fulfilling dreams
Blog:www.leonarding.com
If you like my article, please sweep the following QR code! Concern Number: Leonarding_public
Here you can get technical, practical, hot news and other emerging things thinking and ideas, something else may not be. I will provide you with the latest technology and information dynamics, transfer positive energy.
650) this.width=650; "src=" http://blog.itpub.net/attachment/201501/15/26686207_14213168985KRC.jpg "style=" border : 0px;color:rgb (102,102,102); font-family: ' Song body ', Arial;font-size:12px;line-height:26px;white-space:normal; Background-color:rgb (255,255,255); "alt=" 26686207_14213168985krc.jpg "/>
This article is from the "Liucheng sharing technology ~ Achievement Dream" blog, please be sure to keep this source http://leonarding.blog.51cto.com/6045525/1737753
"Statistics Merchant 24 months continuous running total number of months stored procedures"