Oracle to Teradata SQL equivalents?

General
N/A

Oracle to Teradata SQL equivalents?

Hi all

First post. Apologies in advance if this question has been asked to death before and/ or if I'm posting this to the wrong section.

Bit of background (feel free to skip this part if you don't feel like reading):
I'm responsible for deploying monitoring for various different systems, the latest of which uses a Teradata DB. I'm used to writing and tweaking Oracle SQL scripts, but not at all when it comes to Teradata SQL.

The questions:
I'm looking for a Teradata equivalent to the following Oracle SQL:
Select datecol, someothercol from sometable where datecol >= sysdate - 1/24
In other words, select everything where the datecol values are bigger or equal to one hour ago.

I've googled this quite a lot, but so far the examples I've stumbled across seem to suggest that a date of some sort must be entered each time. I can probably find a way to do this via Python scripting, but hoping for a SQL method to do this.

Then while I'm at it, does anyone perhaps know of an Oracle/ Teradata cheatsheet of some sort? This isn't crucial of course, but just thought I'd ask anyway in the hopes that someone might know of something off the top of their head.

Thanks in advance
Tags (3)
1 REPLY

Re: Oracle to Teradata SQL equivalents?

You can use the following:

SELECT CURRENT_TIMESTAMP(0) - INTERVAL  '1' HOUR;

I doubt that you can not subtract HOUR from date, thats why you will have to either use timestamp, Or convert the date to timstamp format 

like '2013-10-01 00:00:00'

Khurram