Data Type Expressions

Home/Data Type Expressions

Data Type Expressions

Analyze offers a wide variety of standard data types (dtypes) to support your requirements. As datasets become larger, determining smaller size dtypes for value storage can shrink the size of the table and improve performance. The following dtypes are available:

  • Boolean
  • Text
  • Numbers
    • Small Float (6 Digits)
    • Float (15 Digits)
    • Small Integer (16 bit) (-32768 to 32767)
    • Integer (32 bit) (-2147483648 to 2147483647)
    • Big Integer (64 bit) (-9223372036854775808 to 9223372036854775807)
    • Numeric
  • Dates and Times
    • Date
    • Timestamp
    • Time Interval

It is also possible to convert from one dtype to another using the func.cast() process.

Note: Casting to an incompatible dtype may cause errors. For example, casting ‘hello’ to an integer will not work.

func.cast() Type Conversions #

Analyze ExpressionDescriptionResult
func.cast(123, Text)Integer to Text‘123’
func.cast(‘123’, Integer)Text to Integer123
func.cast(‘78.69’, Float)Text to Float78.69
func.cast(‘78.69’, SmallFloat)Text to Small Float78.69
func.cast(‘78.69’, Integer)Text to Integer (Truncate decimals)78
func.cast(‘78.69’, SmallInteger)Text to Small Integer (Truncate decimals)78
func.cast(‘78.69’, BigInteger)Text to Big Integer (Truncate decimals)78
func.cast(1, Boolean)Integer to BooleanTrue Data Type Conversions #

Analyze ExpressionReturn TypeDescriptionExample
func.to_char(timesta mp, text)textconvert time stamp to stringto_char(c urrent_ti mestamp, ‘HH12:MI:S S’)
func.to_char(interva l, text)textconvert interval to stringto_char(i nterval ‘15h 2m 12s’, ‘HH24:MI:S S’)
func.to_char(integer , text)textconvert integer to stringto_char(1 25, ‘999’)
func.to_char(big float, text)textconvert real/double precision to stringto_char(1 25.8::real , ‘999D9’)
func.to_char(numeric , text)textconvert numeric to stringto_char(- 125.8, ‘999D99S’)
func.to_date(text, text)dateconvert string to dateto_date(‘ 05 Dec 2000’, ‘DD Mon YYYY’)
func.to_number(text, text)numericconvert string to numericto_number (‘12,454.8 -‘, ‘99G999D9S ‘)
func.to_timestamp(te xt, text)timestamp with time zoneconvert string to time stampto_timest amp(‘05 Dec 2000’, ‘DD Mon YYYY’)
func.to_timestamp(bi g float)timestamp with time zoneconvert UNIX epoch to time stampto_timest amp(200120 400)
Go to Top