You can translate the question and the replies:

How to use substr / substring function to fetch last n characters of a string

In most databases we are able to fetch last n charaters using substr function in the following manner.... select substr('abcdefghij',-3) from dual; This returns the string 'hij' i.e the last three characters. How would I be able to do the same using Denodo's substr / substring function? Thanks in advance
user
06-04-2018 08:08:07 -0400
code

1 Answer

Hi, In order to retrieve last 'n' characters from an input string value, I would use the 'SUBSTRING/SUBSTR' function available in Denodo which requires three input parameter such as input value of type text, start index, end index of the input value and return a substring of an input string as an output. For example, * SELECT SUBSTRING(<column_name>, LEN(<column_name>)-3, LEN(<column_name>)) from <view_name> By executing the above query in the VQL shell of Virtual DataPort Administration tool, I was able to retrieve last three characters of the input value. For more information, you can have a look at the section [SUBSTRING / SUBSTR](https://community.denodo.com/docs/html/browse/6.0/vdp/vql/appendix/syntax_of_condition_functions/text_processing_functions#substring-substr) and [LEN](https://community.denodo.com/docs/html/browse/6.0/vdp/vql/appendix/syntax_of_condition_functions/text_processing_functions#len) of Virtual DataPort VQL Guide. Hope this helps!
Denodo Team
09-04-2018 23:43:31 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here