Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to convert a string into an integer with SQL in Oracle
How to convert a string into an integer with SQL in Oracle
In oracle, the functions provided by CAST and CONVERT can be displayed by explicitly converting expressions of one data type to another.

(1) uses cast: cast (the expression is data _ type).

(2) Use convert: convert (data _ type [(length)], expression [,style]).

Note: The converted type is the data type provided by the system, and the user-defined data type cannot be used.

1. Implicit conversion: sql automatically converts data from one data type to another. For example, if a smallint variable is compared with an int variable, the smallint variable will be implicitly converted to an int variable before the comparison.

2. Explicit conversion: The CAST and CONVERT functions convert values from one data type (local variables, columns or other expressions) to another. For example, using select cast ('12.5' as decimal (9,2)), the decimal data type will display valid decimal places in the result grid:? 12.50。

References:

SQL Server CONVERT () function

References:

Transact-SQL reference conversion