Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --V1
- SELECT decode(encode(DATA,'IBM037'),'IBM273')
- FROM casting;
- --Where ‘data’ is a string in a table… And the data was loaded without conversion as CSV. Hive still reads it as UTF-8 and needs conversion into EBCDIC 037, then decode it using the ‘correct’ codepage. The output appears to be UTF8 as expected.
- --V2
- --assuming your input codepage is IBM500
- --a is the table you're decoding
- --and b has two fields, a country code identifier that matches something in the table you're decoding
- --and b.encoding contains things like IBM875
- decode(encode(a.cuind_first_name_n,'IBM500'),nvl(b.encoding,'IBM875'))
Add Comment
Please, Sign In to add comment