OCIIntervalAdd
Purpose : You can call this function to add two intervals to generate a resulting interval.
Syntax :
sword OCIIntervalAdd ( void *hndl,
OCIError *err,
OCIInterval *addend1,
OCIInterval *addend2,
OCIInterval *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The Oracle Call Interface (OCI) user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| addend1 (IN) | An interval to be added. |
| addend2 (IN) | An interval to be added. |
| result (OUT) | The resulting interval, which equals addend1 + addend2. |
Return value : OCI_SUCCESS is returned if the function call succeeded, OCI_INVALID_HANDLE is returned if err is a NULL pointer, and OCI_ERROR is returned if the function call failed.
OCIIntervalAssign
Purpose : You can call this function to copy one interval to another interval.
Syntax :
void OCIIntervalAssign ( void *hndl,
OCIError *err,
const OCIInterval *inpinter,
OCIInterval *outinter );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| inpinter (IN) | The input interval. |
| outinter (OUT) | The output interval. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_INVALID_HANDLE is returned if err is a NULL pointer.
OCIIntervalCheck
Purpose : You can call this function to check the validity of an interval.
Syntax :
sword OCIIntervalCheck ( void *hndl,
OCIError *err,
const OCIInterval *interval,
ub4 *valid );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| interval (IN) | The interval to be checked. |
| valid (OUT) | Returns 0 if the interval is valid. |
Return value : OCI_SUCCESS is returned if the function call succeeded, OCI_INVALID_HANDLE is returned if err is a NULL pointer, and OCI_ERROR is returned if the function call failed.
OCIIntervalCompare
Purpose : You can call this function to compare two intervals.
Syntax :
sword OCIIntervalCompare (void *hndl,
OCIError *err,
OCIInterval *inter1,
OCIInterval *inter2,
sword *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| inter1 (IN) | An interval for comparison. |
| inter2 (IN) | An interval for comparison. |
| result (OUT) | The comparison result. For more information, see Additional information in this section. |
Return value : OCI_SUCCESS is returned if the function call succeeded, OCI_INVALID_HANDLE is returned if err is a NULL pointer, and OCI_ERROR is returned if the function call failed.
Additional information
| Comparison result | Output |
|---|---|
inter1<inter2 |
-1 |
inter1=inter2 |
0 |
inter1>inter2 |
1 |
OCIIntervalDivide
Purpose : You can call this function to divide an interval by an Oracle NUMBER to generate a new interval.
Syntax :
sword OCIIntervalDivide ( void *hndl,
OCIError *err,
OCIInterval *dividend,
OCINumber *divisor,
OCIInterval *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| dividend (IN) | The interval that serves as the dividend. |
| divisor (IN) | The Oracle NUMBER that serves as the divisor. |
| result (OUT) | The resulting interval (dividend/divisor). |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_INVALID_HANDLE is returned if err is a NULL pointer.
OCIIntervalFromNumber
Purpose : You can call this function to convert an Oracle NUMBER to an interval.
Syntax :
sword OCIIntervalFromNumber ( void *hndl,
OCIError *err,
OCIInterval *interval,
OCINumber *number );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| interval (OUT) | The resulting interval. |
| number (IN) | The Oracle NUMBER to be converted, in the unit of year for YEAR TO MONTH intervals and in the unit of day for DAY TO SECOND intervals. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_INVALID_HANDLE is returned if err is a NULL pointer.
OCIIntervalFromText
Purpose : You can call this function to return the interval that a given interval string represents. The result descriptor indicates the interval type.
Syntax :
sword OCIIntervalFromText ( void *hndl,
OCIError *err,
const OraText *inpstring,
size_t str_len,
OCIInterval *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| inpstring (IN) | The input string. |
| str_len (IN) | The length of the input string. |
| result (OUT) | The resulting interval. |
Return value : OCI_SUCCESS is returned if the function call succeeded, OCI_INVALID_HANDLE is returned if err is a NULL pointer, and OCI_ERROR is returned if the function call failed.
OCIIntervalGetDaySecond
Purpose : You can call this function to obtain the day, hour, minute, and second values from an interval.
Syntax :
sword OCIIntervalGetDaySecond (void *hndl,
OCIError *err,
sb4 *dy,
sb4 *hr,
sb4 *mm,
sb4 *ss,
sb4 *fsec,
const OCIInterval *interval );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| dy (OUT) | The number of days. |
| hr (OUT) | The number of hours. |
| mm (OUT) | The number of minutes. |
| ss (OUT) | The number of seconds. |
| fsec (OUT) | The number of nanoseconds. |
| interval (IN) | The input interval. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_INVALID_HANDLE is returned if err is a NULL pointer.
OCIIntervalGetYearMonth
Purpose : You can call this function to obtain the year and month values from an interval.
Syntax :
sword OCIIntervalGetYearMonth ( void *hndl,
OCIError *err,
sb4 *yr,
sb4 *mnth,
const OCIInterval *interval );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| yr (OUT) | The year. |
| mnth (OUT) | The month. |
| interval (IN) | The input interval. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_INVALID_HANDLE is returned if err is a NULL pointer.
OCIIntervalMultiply
Purpose : You can call this function to multiply an interval by an Oracle NUMBER to generate another interval.
Syntax :
sword OCIIntervalMultiply ( void *hndl,
OCIError *err,
const OCIInterval *inter,
OCINumber *nfactor,
OCIInterval *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| inter (IN) | The interval to be multiplied. |
| nfactor (IN) | The Oracle NUMBER to be multiplied. |
| result (OUT) | The resulting interval (inter * nfactor). |
Return value : OCI_SUCCESS is returned if the function call succeeded, OCI_INVALID_HANDLE is returned if err is a NULL pointer, and OCI_ERROR is returned if the function call failed.
OCIIntervalSetDaySecond
Purpose : You can call this function to set the numbers of days, hours, minutes, and seconds in an interval.
Syntax :
sword OCIIntervalSetDaySecond ( void *hndl,
OCIError *err,
sb4 dy,
sb4 hr,
sb4 mm,
sb4 ss,
sb4 fsec,
OCIInterval *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| dy (IN) | The number of days. |
| hr (IN) | The number of hours. |
| mm (IN) | The number of minutes. |
| ss (IN) | The number of seconds. |
| fsec (IN) | The number of nanoseconds. |
| result (OUT) | The resulting interval. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_INVALID_HANDLE is returned if err is a NULL pointer.
OCIIntervalSetYearMonth
Purpose : You can call this function to set the year and month in an interval.
Syntax :
sword OCIIntervalSetYearMonth ( void *hndl,
OCIError *err,
sb4 yr,
sb4 mnth,
OCIInterval *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| yr (IN) | The year. |
| mnth (IN) | The month. |
| result (OUT) | The resulting interval. |
Return value : OCI_SUCCESS is returned if the function call succeeded, OCI_INVALID_HANDLE is returned if err is a NULL pointer, and OCI_ERROR is returned if the function call failed.
OCIIntervalSubtract
Purpose : You can call this function to subtract one interval by another and stores the result in an interval.
Syntax :
sword OCIIntervalSubtract ( void *hndl,
OCIError *err,
OCIInterval *minuend,
OCIInterval *subtrahend,
OCIInterval *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| minuend (IN) | The interval to be subtracted from. |
| subtrahend (IN) | The interval subtracted from minuend. |
| result (OUT) | The resulting interval (minuend - subtrahend). |
Return value : OCI_SUCCESS is returned if the function call succeeded, OCI_INVALID_HANDLE is returned if err is a NULL pointer, and OCI_ERROR is returned if the function call failed.
OCIIntervalToNumber
Purpose : You can call this function to convert an interval to an Oracle NUMBER.
Syntax :
sword OCIIntervalToNumber ( void *hndl,
OCIError *err,
OCIInterval *interval,
OCINumber *number );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| interval (IN) | The interval to be converted. |
| number (OUT) | The resulting Oracle NUMBER, in the unit of year for YEARMONTH intervals and in the unit of day for DAYSECOND intervals. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_INVALID_HANDLE is returned if err is a NULL pointer.
OCIIntervalToText
Purpose : For a given interval, you can call this function to generate a string that represents the interval.
Syntax :
sword OCIIntervalToText ( void *hndl,
OCIError *err,
const OCIInterval *interval,
ub1 lfprec,
ub1 fsprec,
OraText *buf );
size_t buflen,
size_t *resultlen );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| interval (IN) | The interval to be converted. |
| lfprec (IN) | The leading field precision, which is used to represent the number of digits of the leading field. |
| fsprec (IN) | The precision of fractional seconds of the interval, which is used to represent the number of digits of the fractional seconds. |
| buffer (OUT) | The buffer for storing the result. |
| buflen (IN) | The length of the buffer. |
| resultlen (OUT) | The length of the result stored in the buffer. |
Return value : OCI_SUCCESS is returned if the function call succeeded, OCI_INVALID_HANDLE is returned if err is a NULL pointer, and OCI_ERROR is returned if the function call failed.