Skip to content
Advertisement

Using Case WHEN to extract with first character

I am using case as an if else statement in my hive database, it seems it is not showing what i am trying to extract as.

i am using this script

in logical concept if at character 44 starts with _ , substring at 45 , else substring at 45

e.g (table look like )

am i using like statement correctly ?

Advertisement

Answer

One method is to replace the value:

However, I think regexp_extract() might be simpler:

The pattern may be simpler, if there is only one sequence of 8 digits surrounded by underscores:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement