Search code examples
oracle-databasetimestampobiee

OBIEE Time Difference between two columns


Can anyone help me as to why this formula isn't working? I have two columns, Time Start and Time Finish, I want to find the difference in hours between them.

cast(floor(mod(TIMESTAMPDIFF(sql_tsi_second, "Worker"."Time Normal Finish","Worker"."Time Normal Start"),3600) /60)as char)

I am getting the error as such:

Formula syntax is invalid.
[nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 22025] Function TimestampDiff is called with an incompatible type. (HY000)
SQL Issued: SELECT cast( floor( mod(TIMESTAMPDIFF(sql_tsi_second, "Worker"."Time Normal Finish","Worker"."Time Normal Start"),3600) /60) as char) FROM "Workforce Management - Absence Real Time"
OK (Ignore Error)

UPDATE: The two columns are plain text format, but i need to find the difference between them: Eg: 17:00-9:00=8 hours


Solution

  • Don't you need to cast your columns before you can run the TIMESTAMPDIFF? That's what the error says: you have an incompatible type. You need to do TIMESTAMPDIFF(sql_tsi_second, cast( ...), cast(...)). Hope this works!