Skip to main content

SQL - Interval Function on a column


Ilan_1
  • Participating Frequently
I am trying to add date to a second from a column and update a new column. This sql is executing fine "select trunc(sysdate-364)+ interval '10' second from dual;" but the interval variable is dynamic and I am trying to specify a column in it say like this "select trunc(sysdate-364)+ interval 'column_name' second from table_name;" and the sql fails let me know how do I specify a column in the interval function. Thanks.

2 replies

Ilan_1
  • Author
  • Participating Frequently
  • July 16, 2013
I was able to solve my requirement using TIMESTAMPADD function. Coming from oracle background there are many SQL functions to learn in vertica.

Sajan_Sangraula
Forum|alt.badge.img+1
This can be done using timestampadd: select timestampadd(ss,intrval,trunc(sysdate-364)) from (select 10 as intrval from dual) a /Sajan