Funzione TIMESTAMP_CMP_TIMESTAMPTZ - Amazon Redshift

Amazon Redshift non supporterà più la creazione di nuove UDF Python a partire dal 1º novembre 2025. Se desideri utilizzare le UDF Python, creale prima di tale data. Le UDF Python esistenti continueranno a funzionare normalmente. Per ulteriori informazioni, consulta il post del blog.

Funzione TIMESTAMP_CMP_TIMESTAMPTZ

TIMESTAMP_CMP_TIMESTAMPTZ confronta il valore di un'espressione di timestamp con quello di un'espressione di timestamp con fuso orario. Se i valori di timestamp e timestamp con fuso orario sono identici, la funzione restituisce 0. Se il primo timestamp è maggiore cronologicamente, la funzione restituisce 1. Se il timestamp con fuso orario è maggiore, la funzione restituisce –1.

Sintassi

TIMESTAMP_CMP_TIMESTAMPTZ(timestamp, timestamptz)

Argomenti

timestamp

Una colonna di tipo di dati TIMESTAMP o un'espressione che restituisce un tipo TIMESTAMP.

timestamptz

Una colonna di tipo di dati TIMESTAMPTZ o un'espressione che restituisce un tipo TIMESTAMPTZ.

Tipo restituito

INTEGER

Esempi

Gli esempi seguenti confrontano i timestamp con i fusi orari e mostrano i risultati del confronto.

SELECT TIMESTAMP_CMP_TIMESTAMPTZ('2008-01-24 06:43:29', '2008-01-24 06:43:29+00'), TIMESTAMP_CMP_TIMESTAMPTZ('2008-01-24 06:43:29', '2008-02-18 02:36:48+00'), TIMESTAMP_CMP_TIMESTAMPTZ('2008-02-18 02:36:48', '2008-01-24 06:43:29+00'); timestamp_cmp_timestamptz | timestamp_cmp_timestamptz | timestamp_cmp_timestamptz ---------------------------+---------------------------+-------------------------- 0 | -1 | 1