Saturday, 22 September 2018

Convert an integer column value from AlphaNumeric values in SQL

For e.g. We have the column value  ' 1.11+build.201701152243 '

Here we have combination of alphabets and numeric and special characters like + and .
Suppose we need to convert it to integer for comparison purpose.

We can convert like below.


CAST(REGEXP_REPLACE(<COLUMN_NAME>,'[^0-9]','') AS INTEGER )

This will first replace everything except digits with empty. After that it will convert that as Integer.
Then we can use that as int for aggregate function.

Difference between class level and object locking and static object lock

1) Class level locking will lock entire class, so no other thread can access any of other synchronized blocks. 2) Object locking will lo...