Parameters (String);
Returns: String;
Function to extract a currency code or symbol from a string
The parameter is the source string containing a currency value and code. For the function to retrieve a currency code:
- The code or symbol in the string must be either before or after the numeric value.
- The code or symbol may separated from the value by either a string or semicolon.
- The code must be less than 3 characters long
- The string must only contain the numeric value and currency code
If no code is found, the function returns NULL
No check is made as to the validity of the code or symbol extracted.
Examples:
GET_CURRENCY_CODE('GBP 12.50') Result: 'GBP'
GET_CURRENCY_CODE('12.50;JPY') Result: 'JPY'
GET_CURRENCY_CODE('12.50') Result: NULL
GET_CURRENCY_CODE(NULL) Result: NULL
GET_CURRENCY_CODE(Hello World) Result: NULL
GET_CURRENCY_CODE('£0') Result: '£'\n'
GET_CURRENCY_CODE('0.0 Dollars') Result: NULL
Comments
0 comments
Please sign in to leave a comment.