Subject | Re: [firebird-support] Get records based on the third portion of a version string |
---|---|
Author | Venus Software Operations |
Post date | 2015-05-12T05:20:59Z |
Implementation too in the software was successful. Thanks a lot!
Kind regards
Bhavbhuti
Kind regards
Bhavbhuti
On 10/05/2015 07:15 pm, LtColRDSChauhan
rdsc1964@... [firebird-support] wrote:
Please check this :
SET TERM ^ ;
ALTER PROCEDURE SP_VERSION_NOS (
PORTION smallint,
SEPARATOR char(1),
VERSION_UPTO varchar(80) )
RETURNS (
VERSION_NO varchar(80) )
AS
declare variable i smallint;
declare variable SEPARATOR_POS Integer;
declare variable VERSION_UPTO_PORTION_INT integer;
declare variable VERSION_i varchar(80);
declare variable VERSION_i_PORTION_INT integer;
BEGINi = 1;
while (:PORTION > :i) do begin
select position(:SEPARATOR in :VERSION_UPTO) from RDB$DATABASE into :SEPARATOR_POS;
if(0 != :SEPARATOR_POS) then begin
VERSION_UPTO = substring(:VERSION_UPTO from (:SEPARATOR_POS + 1) for char_length(:VERSION_UPTO));
end
i = 1 + :i;
end
select position(:SEPARATOR in :VERSION_UPTO) from RDB$DATABASE into :SEPARATOR_POS;
if(0 != :SEPARATOR_POS) then begin
VERSION_UPTO = substring(:VERSION_UPTO from 1 for :SEPARATOR_POS - 1);
end else begin
VERSION_UPTO = substring(:VERSION_UPTO from 1 for char_length(:VERSION_UPTO));
end
VERSION_UPTO_PORTION_INT = cast(:VERSION_UPTO as integer);
FOR SELECT a.VERSION_NO FROM VERSION_NOS a INTO :VERSION_NO
DO BEGIN
VERSION_i = :VERSION_NO;
i = 1;
while (:PORTION > :i) do begin
select position(:SEPARATOR in :VERSION_i) from RDB$DATABASE into :SEPARATOR_POS;
if(0 != :SEPARATOR_POS) then begin
VERSION_i = substring(:VERSION_i from (:SEPARATOR_POS + 1) for char_length(:VERSION_i));
end
i = 1 + :i;
end
select position(:SEPARATOR in :VERSION_i) from RDB$DATABASE into :SEPARATOR_POS;
if(0 != :SEPARATOR_POS) then begin
VERSION_i = substring(:VERSION_i from 1 for :SEPARATOR_POS - 1);
end else begin
VERSION_i = substring(:VERSION_i from 1 for char_length(:VERSION_i));
end
VERSION_i_PORTION_INT = cast(:VERSION_i as integer);
if(:VERSION_UPTO_PORTION_INT >= :VERSION_i_PORTION_INT) then begin
SUSPEND;
end
END
/* SELECT p.VERSION_NO FROM SP_VERSION_NOS ('3', '.', '1.23.450.789') p;*/
END^
SET TERM ; ^
GRANT EXECUTE
ON PROCEDURE SP_VERSION_NOS TO SYSDBA;
-- Thanking you. Yours Faithfully, For Venus Software Operations ---- Mr. Bhavbhuti Nathwani ___________________________________________ Softwares for Indian Businesses at: http://www.venussoftop.com venussoftop@... venussoftop@... ___________________________________________ Please note: We reserve complete rights for policy changes in the future and the same will be applicable immediately as and when made. Attachments may get corrupted before reaching you, in such a situation please let us know and we will resend you the same at the earliest. We do not take any responsibility for data loss of any type and kind. Data safety remains the sole the responsibility of the users of our softwares. ___________________________________________ Internet email confidentiality: This message may contain information that may be privileged or confidential. If you are not the addressee nor are you responsible for the delivery of the message to the addressee indicated in this email, then you may not copy or deliver this email to anyone and you should notify the sender by reply email and then destroy this message. Please reply email immediately to this message with REMOVE in the subject, if you or your employer do not consent to email of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of my firm shall be understood as neither given nor endorsed by my company.