Search code examples
sqloracle-databasehivehqlhiveql

How to convert Oracle SQL date time into Hive Query format and then perform subtraction?


I am converting Oracle SQL time to Hive format.

Oracle: TO_DATE(CURRENT_DATE)- INTERVAL '1' MINUTE

How can I write above in Hive Query?

For this part I can write like this:

TO_DATE( FROM_UNIXTIME( UNIX_TIMESTAMP(CURRENT_DATE)) )

if this is true then how can I subtract (- INTERVAL '1' MINUTE)?


Solution

  • If you are using version 1.2 or later you can use this command:

    CURRENT_DATE - INTERVAL '1' MINUTE