28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Function Syntax Purpose<br />

daysbetween daysbetween(date1, date2)<br />

daysbetween(daydate1, daydate2)<br />

daysbetween(seconddate1,<br />

seconddate2)<br />

daysbetween(longdate1, longdate2)<br />

secondsbetween secondsbetween(seconddate1,<br />

seconddate2)<br />

secondsbetween(longdate1, longdate2)<br />

returns the number of days (integer)<br />

between date1 and date2. The first<br />

version is an alternative to date2 - date1.<br />

Instead of rounding or checking for<br />

exactly 24 hours distance, this will<br />

truncate both date values today<br />

precision and subtract the resulting day<br />

numbers, meaning that if arg2 is not the<br />

calendar day following arg1,<br />

daysbetween will return 1 regardless of<br />

the time components of arg1 and arg2.<br />

returns the number of seconds the first<br />

to the second arg, as a fixed point<br />

number. The returned value is positive if<br />

the first argument is less than the<br />

second. The return values are fixed18.0<br />

in both cases (note that it may prove<br />

more useful to use fixed11.7 in case of<br />

longdate arguments).<br />

component component(date, int) the int argument may be int the range<br />

1..6, the values mean year, day, month,<br />

hour, minute, second, respectively. If a<br />

component is not set in the date, the<br />

component function will return a default<br />

value, 1 for the month or the day, 0 for<br />

other components. The component<br />

function may also be applied to<br />

longdate and time types.<br />

addseconds addseconds(date, int)<br />

addseconds(seconddate, decfloat)<br />

addseconds(longdate, decfloat)<br />

adddays adddays(date, int)<br />

Misc Functions<br />

adddays(daydate, int)<br />

adddays(seconddate, int)<br />

adddays(longdate, int)<br />

Return a date plus a number of seconds.<br />

Fractional seconds will also be used in<br />

case of longdate. Null handling is (in<br />

opposition to the default done with<br />

adds) to return null if any argument is<br />

null.<br />

Return a date plus a number of days.<br />

Null handling is (in opposition to the<br />

default done with adds) to return null if<br />

any argument is null.<br />

Function Syntax Purpose Example<br />

if if(intarg, arg2, arg3) return arg2 if intarg is<br />

considered true (not equal to<br />

zero), else return arg3.<br />

Currently, no shortcut<br />

evaluation is implemented,<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Setting Up the Analytic Model<br />

if("NETWR"

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!