Subject | Looking for a Firebird Stored Procedure to return a string showing 1-20,24,26-27,30 |
---|---|
Author | SoftTech |
Post date | 2009-07-23T15:28Z |
Greetings All,
Using Firebird 1.53
I want to return a list of debt numbers to the user interface.
But instead of this
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,24,26,27,30
I would like to return something like this 1-20,24,26-27,30
Currently my SP returns all in a comma delimited list as shown here
DECLARE VARIABLE iDebtNo SmallInt;
begin
TRAN_DEBT_LIST = '';
iLastDebtNo = 0;
FOR SELECT DISTINCT ATDTD.DEBT_NO
FROM ACCT_TRAN_DETAIL_TASK_DEBTS ATDTD
WHERE ATDTD.ACCT_TRAN_ID = :V_ACCT_TRAN_ID
ORDER BY ATDTD.DEBT_NO
INTO :iDebtNo DO
BEGIN
IF (TRAN_DEBT_LIST <> '') THEN
TRAN_DEBT_LIST = TRAN_DEBT_LIST || ',';
TRAN_DEBT_LIST = TRAN_DEBT_LIST || :iDebtNo;
END
end
Does anyone have a SP they can share tat would return it in the format
desired? Or any tips on how I might do it?
Thanks to any and all who reply,
Mike
Using Firebird 1.53
I want to return a list of debt numbers to the user interface.
But instead of this
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,24,26,27,30
I would like to return something like this 1-20,24,26-27,30
Currently my SP returns all in a comma delimited list as shown here
DECLARE VARIABLE iDebtNo SmallInt;
begin
TRAN_DEBT_LIST = '';
iLastDebtNo = 0;
FOR SELECT DISTINCT ATDTD.DEBT_NO
FROM ACCT_TRAN_DETAIL_TASK_DEBTS ATDTD
WHERE ATDTD.ACCT_TRAN_ID = :V_ACCT_TRAN_ID
ORDER BY ATDTD.DEBT_NO
INTO :iDebtNo DO
BEGIN
IF (TRAN_DEBT_LIST <> '') THEN
TRAN_DEBT_LIST = TRAN_DEBT_LIST || ',';
TRAN_DEBT_LIST = TRAN_DEBT_LIST || :iDebtNo;
END
end
Does anyone have a SP they can share tat would return it in the format
desired? Or any tips on how I might do it?
Thanks to any and all who reply,
Mike