0

I have a table in sql that is map,string,struct,array,string. I have accessed the value by using element_at(k,v) which works. My issue is the column has values like '#"nike"#','#"REEBOK"#'. I have tried stripping the characters(,#), I have tried regex_extract and regex_replace, but I keep getting the error:

Unexpected parameters(map(varchar(row(input varchar(input(array(varchar),input,textinput() expected element_at(array(E), element_map(K,V),K)K,V

SELECT 
    REGEXP_REPLACE(col, '"[^"]*"', '')
FROM table;

is there a way to strip or extract the words in between the " " characters?

3
  • Which dbms are you using? Commented Mar 18, 2023 at 16:08
  • Athena presto sql Commented Mar 18, 2023 at 16:11
  • Can you please add sample data and desired output? Commented Mar 19, 2023 at 13:09

1 Answer 1

0

Try this:

SELECT
    REGEXP_REPLACE(col, '[#"]', '') AS cleaned_col
FROM table;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.