we can do as follow:
Code: Select all
SELECT "S1" FROM
UNION SELECT "S1" FROM
UNION SELECT "S1" FROM
etc
Code: Select all
SELECT "S1" FROM
UNION SELECT "S1" FROM
UNION SELECT "S1" FROM
etc
Code: Select all
white*blue*red*green*orange
Code: Select all
SELECT * FROM UNNEST( (SELECT REGEXP_SUBSTRING_ARRAY( "TXT", '.\x2C*' ) FROM TBL WHERE ID=13))
Code: Select all
white*blue*red*green*orange
arfgh wrote:no, that wasnt what i want...
While I am not at all clear on what you want . . . the sample user Villeroy provided DOES work perfectly for me, and, with my understanding of what user arfgh wanted as output.arfgh wrote:with that string, and the '*' as split character. We want o obtain all splits string in a single comun and all the rows that are required to obtain the splits. But once that is done, the query should do the same with other split number.Code: Select all
white*blue*red*green*orange
Code: Select all
-- Example of using HSQL Version 2.x back-end database with UNNEST for ARRAY processing
-- The table I am using is named "PEUGEOT_PART" and it contains various columns
-- My column "DESCRIPTION" contains commas ( \x2C ) and a space ( \x2o ) in REGEXP_SUBSTRING_ARRAY function
SELECT
"PEUGEOT_PART"."ID",
"PEUGEOT_PART"."DESCRIPTION",
"PEUGEOT_PART"."PRICE",
REPLACE("MY_TABLE"."MY_OUTPUT_STRING", ', ', SPACE(0)) as "MY_OUTPUT_STRING"
FROM "PEUGEOT_PART",
-- Use HSQL 2.x UNNEST function for ARRAY processing
UNNEST((
SELECT
REGEXP_SUBSTRING_ARRAY("PEUGEOT_PART_02"."DESCRIPTION", '.+?\x2c\x20|.+$')
FROM "PEUGEOT_PART" as "PEUGEOT_PART_02"
WHERE "PEUGEOT_PART_02"."ID" = "PEUGEOT_PART"."ID"
)) as "MY_TABLE"("MY_OUTPUT_STRING") -- This is the array name and the name of array column
You have NOT told us the database back-end you are using and you still, have NOT said the database back-end you are using, just:arfgh wrote:This example assumes the use of HSQL Version 2.x as the database back-end ( NOT the embedded HSQL database ( Version 1.8.0.10 ) ).
yes, embedded hsql database...
I can do this in basic, but sql will be the best way if possible to avoid duplicates and do a fast sorting. In basic, with quicksork and remove duplicates, take some time to process. So i am looking badly for a way to do it in sql... it should be possible by some way...
Therefore, since I am writing this NOT just for you, but, for other forum users reading this post, the answers given might help them.arfgh wrote:yes, embedded hsql database...
It is possible, for example, with HSQL Version 2.x as demonstrated above, or the current version of H2 database back-end.arfgh wrote:it should be possible by some way...