HomeНаука и техникаRelated VideosMore From: Database Star

Oracle CAST Function

12 ratings | 2109 views
https://www.databasestar.com/oracle-cast/ The Oracle CAST function allows you to convert one data type to another. It’s similar to the TO_NUMBER, TO_DATE, and TO_CHAR functions, but allows for more functionality, including converting to many other data types. The syntax of the CAST function is: CAST( {expr | MULTISET (subquery) } AS type_name ) The structure of this function is different to other functions, because it uses the word AS to separate parameters rather than a comma. You can run this function like many other functions, on a single row, which would look like this: CAST( expr AS type_name ) Or, you can run it as though it’s a subquery, using the MULTISET feature: CAST( MULTISET (subquery) AS type_name ) The parameters of the CAST function are: - expr (mandatory choice): This is the value or expression that is to be converted to another data type. - MULTISET (optional): This keyword indicates that the subquery results will return multiple rows, and are then CAST into a collection value. If this is omitted, and the subquery returns multiple rows, it will only return a single row. - subquery (mandatory choice): This is the subquery that can be run to be converted into a collection data type. - type_name (mandatory): This is the Oracle data type that the expr or subquery will be converted to. There are several data types that are compatible with the CAST function, both for converting from and to. You can find the full list in the article mentioned below. For more information about the Oracle CAST function, including all of the SQL shown in this video and the examples, read the related article here: https://www.databasestar.com/oracle-cast/
Html code for embedding videos on your blog
Text Comments (0)

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.