Re: Is it possible SUM(STRINGCOLUMN) ????

From: Steve Bell <swayne.bell_at_sympatico.ca>
Date: Tue, 13 Feb 2001 13:53:16 GMT
Message-ID: <3A8939BF.C3BD4F69_at_sympatico.ca>


Hi Benoit,

What if you try a script like this? I'm just trying to show how to concatenate col3..
you'd have to alter it to fit what you need..

SET SERVEROUTPUT ON DECLARE CONVAR VARCHAR2(10); CURSOR CON_CURSOR IS
SELECT COL1,COL2,COL3
FROM ABC; BEGIN
FOR CON_REC IN CON_CURSOR LOOP
CONVAR := CONVAR||CON_REC.COL3;
END LOOP;
DBMS_OUTPUT.PUT_LINE(CONVAR);
END;
/

SQL> _at_CONSCRIPT
AABBCCDD PL/SQL procedure successfully completed.

Hope this points you the right way.
Steve

Benoit Courchesne wrote:

> Hi,
>
> Let say i have the following table
>
> Table ABC
> -----------------------------
> COL1 COL2 COL3
> 1 2 'AA'
> 1 2 'BB'
> 1 2 'CC'
> 1 2 'DD'
>
> select Col1, Col2, SUM(COL3)
> from table ABC
> group by Col1, Col2
>
> And that will return
>
> COL1 COL2 COL3
> 1 2 'AABBCCDD'
>
> I know that the previous example is not possible but does anyone know a way
> to achieve that ???
Received on Tue Feb 13 2001 - 14:53:16 CET

Original text of this message