Additional Meta-SQL Functions

Meta-SQL constructs are used in functions that pass SQL strings.

The following table provides a list of Meta-SQL functions that you can use in query expressions in GE Digital APM.

Note: All date and time functions listed in this table operate on UTC.
Description

Meta-SQL Function

Construction
Change a number or date value to a character value. CastChar

CastChar(expression [, length])

Expression: Column or literal of type character, number or datetime.

Length: Maximum (e.g., truncated) length of resulting string. No padding will occur.

Change a character value to a datetime value. Date literals must be of the format YYYY-MM-DD. CastNum

CastNum(expression)

Expression: Column or literal of type character.

Change a character value to a datetime value. Date literals must be of the format YYYY-MM-DD. CastDate CastNum(expression)

Expression: Column or literal of type character.

Find the index (numbering from 1) of one string in another string. If the index is not found, the value 0 is returned. IndexOf

IndexOf(lookin, findin [, startat])

Lookin: String in which to find a value.

Findin: String to look for within lookin.

Startat: Starting location for the search. Must be 1 or greater.

Return characters from expression starting in position startat (numbering from 1) and optionally going for length characters. Substring

Substring(expression, startat [, length])

Expression: String from which characters should be returned.

Startat: Starting location for extract. Must be 1 or greater.

Length: Number of characters to return.

Remove leading spaces from a character value. LTrim

LTrim(expression)

Expression: Character value.

Remove trailing spaces from a character value. RTrim

RTrim(expression)

Expression: Character value.

Return the 4-digit year of a date value. Year

Year(expression)

Expression: Datetime value.

Return the 1- or 2-digit day of the month of a date value. Month

Month(expression)

Expression: Datetime value.

Return the datetime of the server where the database resides. This method must return UTC, because all dates in the GE Digital APM database are UTC. Day

Day(expression)

Expression: Datetime value.

Return the local time of the database server. SysDate SysDate
Return the date of the last day of the month for the argument expression. LastDate LastDate(expression)

Expression: Datetime value.

Evaluate one or more When expressions and return the appropriate Then expression. The Else condition is optional. The End statement is required. This function returns the datatype thenexpression. Case

Case evalexpression When whenexpression Then thenexpression [When whenexpression Then thenexpression] [Else thenexpression] End

Evalexpression: Any column or literal value.

Whenexpression: Must be same datatype of evalexpression.

Thenexpression: All must be the same datatype. Does not have to be the same datatype as evalexpression or whenexpression.

Copyright © 2018 General Electric Company. All rights reserved.