"Statistics Merchant 24 months continuous running total number of months stored procedures"

Source: Internet
Author: User

"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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.