|
Oracle® OLAP Java API Reference 11g Release 1 (11.1) B28128-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.olapi.syntax.SyntaxObject
oracle.olapi.syntax.DataObject
oracle.olapi.syntax.Expression
oracle.olapi.syntax.TypedExpression
oracle.olapi.syntax.RowExpression
oracle.olapi.syntax.IntervalLiteralExpression
public final class IntervalLiteralExpression
A RowExpression
that represents an interval literal expression, which is similar to a SQL interval literal expression. An interval literal specifies a period of time. You can specify the time period in years and months, or in days, hours, minutes, and seconds.
Oracle Database supports two types of interval literals, YEAR TO MONTH
and DAY TO SECOND
. Each type contains a leading period and a trailing period. The leading period defines the basic unit of date or time being measured. The trailing period defines the smallest increment of the basic unit being considered. For example, a YEAR TO MONTH
interval considers an interval of years to the nearest month. A DAY TO SECOND
interval literal can specify various combinations of intervals, such as DAY TO MINUTE
, which considers an interval of days to the nearest minute.
For all interval literals, the leading period must specify a larger time unit than time unit of the trailing period. If you have date data in numeric form, then you can use the NUMTOYMINTERVAL
or NUMTODSINTERVAL
conversion function to convert the numeric data into interval values. Interval literals are used primarily with analytic functions.
For more information, see Interval Literals in Oracle Database SQL Language Reference.
Field Summary | |
---|---|
static java.lang.String |
DAY A constant that represents a DAY period. |
static int |
DEFAULT_FRACTIONAL_SECONDS_PRECISION A constant that represents a default value for the precision of the fractional seconds for a leading or trailing SECOND period. |
static int |
DEFAULT_LEADING_PRECISION A constant that represents a default value for the precision of the leading period. |
static java.lang.String |
HOUR A constant that represents a HOUR period. |
static java.lang.String |
MINUTE A constant that represents a MINUTE period. |
static java.lang.String |
MONTH A constant that represents a MONTH period. |
static java.lang.String |
SECOND A constant that represents a SECOND period. |
static java.lang.String |
YEAR A constant that represents a YEAR period. |
Constructor Summary | |
---|---|
IntervalLiteralExpression(java.lang.String value, java.lang.String leadingPeriod, int leadingPrecision, int leadingFractionalSecondsPrecision, java.lang.String trailingPeriod, int trailingFractionalSecondsPrecision) Creates an IntervalLiteralExpression that has the specified value, periods, and precisions. |
|
IntervalLiteralExpression(java.lang.String value, java.lang.String leadingPeriod, int leadingPrecision, java.lang.String trailingPeriod) Creates an IntervalLiteralExpression that has the specified value, periods, and precision. |
|
IntervalLiteralExpression(java.lang.String value, java.lang.String leadingPeriod, java.lang.String trailingPeriod) Creates an IntervalLiteralExpression that has the specified value and periods. |
Method Summary | |
---|---|
int |
getLeadingFractionalSecondsPrecision() Gets the fractional seconds precision for the value for the leading seconds period of this IntervalLiteralExpression . |
java.lang.String |
getLeadingPeriod() Gets the type of the leading time period of this IntervaLiterallExpression . |
int |
getLeadingPrecision() Gets the precision for the value for the leading period of this IntervalLiteralExpression . |
int |
getTrailingFractionalSecondsPrecision() Gets the fractional seconds precision of the value for the trailing seconds period of this IntervalLiteralExpression . |
java.lang.String |
getTrailingPeriod() Gets the type of the trailing time period of this IntervaLiterallExpression . |
java.lang.String |
getValue() Gets the values for the leading and trailing periods of this IntervaLiterallExpression . |
java.lang.Object |
visit(SyntaxObjectVisitor visitor, java.lang.Object context) Calls the visitIntervalLiteralExpression method of the SyntaxObjectVisitor and passes that method this IntervalLiteralExpression and an Object . |
Methods inherited from class oracle.olapi.syntax.RowExpression |
---|
isCompositeObject |
Methods inherited from class oracle.olapi.syntax.Expression |
---|
getSource |
Methods inherited from class oracle.olapi.syntax.SyntaxObject |
---|
fromSyntax, fromSyntax, fromSyntax, fromSyntax, fromSyntax, isValid, toSyntax, toSyntax, toSyntax, toSyntax, toSyntax |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DAY
DAY
period.
public static final java.lang.String HOUR
HOUR
period.
public static final java.lang.String MINUTE
MINUTE
period.
public static final java.lang.String SECOND
SECOND
period.
public static final java.lang.String YEAR
YEAR
period.
public static final java.lang.String MONTH
MONTH
period.
public static final int DEFAULT_LEADING_PRECISION
public static final int DEFAULT_FRACTIONAL_SECONDS_PRECISION
SECOND
period.
Constructor Detail |
---|
public IntervalLiteralExpression(java.lang.String value, java.lang.String leadingPeriod, int leadingPrecision, int leadingFractionalSecondsPrecision, java.lang.String trailingPeriod, int trailingFractionalSecondsPrecision)
IntervalLiteralExpression
that has the specified value, periods, and precisions. The following are examples of using this constructor.
IntervalLiteralExpression intLitExpr = new IntervalLiteralExpression( "200 5:12:10:222", IntervalLiteralExpression.DAY, 3, IntervalLiteralExpression.DEFAULT_FRACTIONAL_SECONDS_PRECISION, IntervalLiteralExpression.SECOND, 3); System.out.println("The syntax of intLitExpr is " + intLitExpr.toSyntax()); System.out.println("The data type of intLitExpr is " + intLitExpr.getDataType().getName()); IntervalLiteralExpression intLitExpr2 = new IntervalLiteralExpression( "11:12:10.1234567", IntervalLiteralExpression.HOUR, IntervalLiteralExpression.DEFAULT_LEADING_PRECISION, IntervalLiteralExpression.DEFAULT_FRACTIONAL_SECONDS_PRECISION, IntervalLiteralExpression.SECOND, 7); System.out.println("The syntax of intLitExpr2 is " + intLitExpr2.toSyntax()); System.out.println("The data type of intLitExpr2 is " + intLitExpr2.getDataType().getName());The output of the examples is the following.
The syntax of intLitExpr is INTERVAL '200 5:12:10:222' DAY(3) TO SECOND (3) The data type of intLitExpr is INTERVAL DAY TO SECOND The syntax of intLitExpr2 is INTERVAL '11:12:10.1234567' HOUR TO SECOND (7) The data type of intLitExpr2 is INTERVAL DAY TO SECOND
value
- A String
that contains values for the leading and trailing time periods.leadingPeriod
- One of the constants of this class that specifies the type of leading time period.leadingPrecision
- An integer that specifies the precision of the value of the leading time period.leadingFractionalSecondsPrecision
- An integer that specifies the precision of the value of the leading seconds time period.trailingPeriod
- One of the constants of this class that specifies the type of trailing time period, which must be less significant than the leading period.trailingFractionalSecondsPrecision
- An integer that specifies the precision of the value of the trailing seconds time period.public IntervalLiteralExpression(java.lang.String value, java.lang.String leadingPeriod, int leadingPrecision, java.lang.String trailingPeriod)
IntervalLiteralExpression
that has the specified value, periods, and precision. The following is an example of using this constructor.
IntervalLiteralExpression intLitExpr3 = new IntervalLiteralExpression( "123-2", IntervalLiteralExpression.YEAR, 3, IntervalLiteralExpression.MONTH); System.out.println("The syntax of intLitExpr3 is " + intLitExpr3.toSyntax()); System.out.println("The data type of intLitExpr3 is " + intLitExpr3.getDataType().getName());The output of the example is the following.
The syntax of intLitExpr3 is INTERVAL '123-2' YEAR(3) TO MONTH The data type of intLitExpr3 is INTERVAL YEAR TO MONTH
value
- A String
that contains values for the leading and trailing time periods.leadingPeriod
- One of the constants of this class that specifies the type of leading time period.trailingPeriod
- One of the constants of this class that specifies the type of trailing time period, which must be less significant than the leading period.leadingPrecision
- An integer that specifies the precision of the value of the leading time period.public IntervalLiteralExpression(java.lang.String value, java.lang.String leadingPeriod, java.lang.String trailingPeriod)
IntervalLiteralExpression
that has the specified value and periods. The following are examples of using this constructor.
IntervalLiteralExpression intLitExpr4 = new IntervalLiteralExpression( IntervalLiteralExpression.YEAR, IntervalLiteralExpression.MONTH, "12-9"); System.out.println("The syntax of intLitExpr4 is " + intLitExpr4.toSyntax()); System.out.println("The data type of intLitExpr4 is " + intLitExpr4.getDataType().getName()); IntervalLiteralExpression intLitExpr5 = new IntervalLiteralExpression( IntervalLiteralExpression.MINUTE, IntervalLiteralExpression.SECOND, "10:22"); System.out.println("The syntax of intLitExpr5 is " + intLitExpr5.toSyntax()); System.out.println("The data type of intLitExpr5 is " + intLitExpr5.getDataType().getName());The output of the examples is the following.
The syntax of intLitExpr4 is INTERVAL '12-9' YEAR TO MONTH The data type of intLitExpr4 is INTERVAL YEAR TO MONTH The syntax of intLitExpr5 is INTERVAL '10:22' MINUTE TO SECOND The data type of intLitExpr5 is INTERVAL DAY TO SECOND
value
- A String
that contains values for the leading and trailing time periods.leadingPeriod
- One of the constants of this class that specifies the type of leading time period.trailingPeriod
- One of the constants of this class that specifies the type of trailing time period, which must be less significant than the leading period.Method Detail |
---|
public java.lang.Object visit(SyntaxObjectVisitor visitor, java.lang.Object context)
visitIntervalLiteralExpression
method of the SyntaxObjectVisitor
and passes that method this IntervalLiteralExpression
and an Object
.visit
in class SyntaxObject
visitor
- A SyntaxObjectVisitor
.context
- An Object
.Object
returned by the visitIntervalLiteralExpression
method.public java.lang.String getLeadingPeriod()
IntervaLiterallExpression
.String
that contains the leading time period of this IntervaLiterallExpression
, which is the value of one of the constants of this class.public java.lang.String getTrailingPeriod()
IntervaLiterallExpression
.String
that contains the trailing time period of this IntervaLiterallExpression
, which is the value of one of the constants of this class.public java.lang.String getValue()
IntervaLiterallExpression
. The values specify the number of units of the periods.String
that contains values that specify the number of units for the leading and trailing time periods.public int getLeadingPrecision()
IntervalLiteralExpression
.TypedExpression
that resolves to an integer value.public int getLeadingFractionalSecondsPrecision()
IntervalLiteralExpression
.public int getTrailingFractionalSecondsPrecision()
IntervalLiteralExpression
.
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |