Differences in usage of the Decode function in Hive and Oracle

foreword

In the process of building the data warehouse, data migration needs to be carried out from the business side! Most companies use data warehouses Hive, while the business side mostly uses Oracledatabases. Recently, a small partner encountered a problem during the migration:
insert image description here
Judging from the error report, Decode()there is a problem with passing parameters when using the function!
Now that the problem has come, let's solve it. Only by constantly solving the problem can the value be reflected!

Decode function in Hive

First look at how the Hivemiddle Decodefunction is defined

desc function extended decode;

Execute the above statement to view Decodethe function definition SQL, the result is as follows:

decode(bin, str)

Guess you like

Origin blog.csdn.net/u011109589/article/details/131193568