My requirement is to check whether the value is numeric or alpha numeric in DB2 query, I didn't get any functions available in DB2. so any idea on the same.
            Asked
            
        
        
            Active
            
        
            Viewed 1,307 times
        
    1 Answers
2
            An example of how you could use the XQuery function fn:matches() in DB2 to check for numeric or alphanumeric strings based on a regular expression is documented in one of the answers here. The core of the idea is here:
xmlcast(
     xmlquery('fn:matches($YOUR_STRING,"your pattern")') 
     as integer) = 1
The question is how you define alphanumeric or numeric. Some good regular expressions are in this discussion.
 
    
    
        Community
        
- 1
- 1
 
    
    
        data_henrik
        
- 16,724
- 2
- 28
- 49
 
    