Prev | Current Page 198 | Next

Rick Greenwald, Robert Stackowiak, Jonathan Stern

"Oracle Essentials: Oracle Database 11g"

For instance, assigning a character value such as 10 to a NUMBER column
results in an automatic data conversion.
If you attempt to assign an alphabetic value to a numeric datatype, you will end up
with an unexpected (and invalid) numeric value, so you should make sure that
you??™re assigning values appropriately.
Youcan also perform explicit conversions on data, using a variety of conversion
functions available with Oracle. Explicit data conversions are better to use if a
conversion is anticipated, because they document the conversion and avoid the possibility
of going unnoticed, as implicit conversions sometimes do.
Concatenation and Comparisons
The concatenation operator for Oracle SQL on most platforms is two vertical lines
(||). Concatenation is performed with two character values. Oracle??™s automatic type
conversion allows you to seemingly concatenate two numeric values. If NUM1 is a
numeric column with a value of 1, NUM2 is a numeric column with a value of 2, and
NUM3 is a numeric column with a value of 3, the following expressions are TRUE:
NUM1 || NUM2 || NUM3 = "123"
NUM1 || NUM2 + NUM3 = "15" (12 + 3)
NUM1 + NUM2 || NUM3 = "33" (1+ 2 || 3)
The result for each of these expressions is a character string, but that character string
can be automatically converted back to a numeric column for further calculations.


Pages:
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
perfumy fm Anteny satelitarne apartamenty przy plaży online loan for bad credit rekuperatory