oracle to teradata

Database
Enthusiast

oracle to teradata

How can we convert this oracle logic into teradata.

PLAN_END_DT > TRUNC(SYSDATE-1)

AND PLAN_END_DT < TRUNC(SYSDATE)
it gives data for one compleate day.....
3 REPLIES
Enthusiast

Re: oracle to teradata

Hi bharath111
trunc(sysdate-1) gives sysdate-1 in oracle
trunc(sysdate) gives sysdate in oracle
this can be illustrated from the following examples.
The syntax for trunc is trunc ( date, [ format ] )
1.trunc('22-sep-07','yyyy') gives the starting day of that year i.e '01-jan-07'
2.trunc('22-sep-07','DDD') gives the date only i.e '22-sep-07'
3.trunc('22-sep-07','month') gives the starting date of the month i.e '01-sep-07'
4.trunc('22-sep-07') gives the date only i.e '22-sep-07'(equal to example 2)
here we havent mentioned the format.So the default format is 'DDD'
SO IN YOUR CASE ALSO IT GIVES THE DATE ONLY.

So,i hope you can replace sysdate by current_date or date in teradata sql.

Enthusiast

Re: oracle to teradata

Trun(sysdate-1) gives me date and time stamp as 00:00:00.
How i can get this in Teradata
Enthusiast

Re: oracle to teradata

TRUNC(SYSDATE-1) GIVES THE DATE ONLY thatswhat i said previously.
if you want the date and timestamp as 00:00:00
try this query
SEL CAST(CURRENT_DATE AS TIMESTAMP(0))