Look at the contents of the table you are using first
SELECT * from YHB;
Desired effect
Concatenate strings for the isdropout column of times 1
Isdropout Times
Yes, no, it's 1.
1. Using the Wmsys.wm_concat (EXP1) function
The SQL statements are as follows:
Select Wmsys.wm_concat (a.isdropout) isdropout from YHB a where a.times=1;
Note that when the content in the EXP1 is very long, there will be errors with a string length that is too large, and you need to use a different method as follows
2. Using the Sys.stragg (EXP1) function
Select Sys.stragg (a.isdropout) isdropout from YHB a where a.times=1;
From the results can be seen, Sys.stragg (EXP1) function to get the result of simply splicing the string together, there is no delimiter, so need to process
Select Trim (both ', ' from Sys.stragg (To_char (a.isdropout) | | NVL2 (A.isdropout, ', ', ')) as Isdropout from YHB a where a.times=1;
Where trim is to remove the end of the, number, NVL2 (EXPR1,EXPR2,EXPR3) function functions as follows
Functions: Common functions in Oracle, if the parameter expression EXPR1 value is null, the NVL2 () function returns the value of the parameter expression Expr3, or the NVL2 () function returns the value of the parameter expression expr2 if the parameter expression expr1 value is not null.
Note: Oracle refers to strings with single quotes, such as NVL2 (A.isdropout, ', ', '), and cannot be enclosed in double quotes
Oracle Stitching String