Oracle / PLSQL: TO_DSINTERVAL Function

This article is written about how to use the Oracle/PLSQL TO_DSINTERVAL feature with syntax and examples.

Description

The Oracle/PLSQL TO_DSINTERVAL function converts a string to an INTERVAL DAY TO SECOND type.

Syntax

The syntax for the TO_DSINTERVAL feature in Oracle/PLSQL is:

TO_DSINTERVAL( character [ nls_parameter ] )

Parameters or Arguments

character The price to convert to an INTERVAL DAY TO SECOND type. It can be a char, varchar2, nchar, or nvarchar2 value. nls_parameter Optional. A decimal persona and crew separator value.

Returns

The TO_DSINTERVAL characteristic returns a INTERVAL DAY TO SECOND value.

Applies To

The TO_DSINTERVAL characteristic can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i

Example

Let’s look at some Oracle TO_DSINTERVAL feature examples and explore how to use the TO_DSINTERVAL characteristic in Oracle/PLSQL.

For example:

TO_DSINTERVAL('150 08:30:00')
Result: '+000000150'

TO_DSINTERVAL('80 12:30:00')
Result: '+000000080'

TO_DSINTERVAL('95 18:30:00')
Result: '+000000095'