Saving all output to "!!{outputDirectory}!!/udf_xpath_short.q.raw". Enter "record" with no arguments to stop it.
>>> !run !!{qFileDirectory}!!/udf_xpath_short.q
>>> DESCRIBE FUNCTION xpath_short ;
'tab_name'
'xpath_short(xml, xpath) - Returns a short value that matches the xpath expression'
1 row selected
>>> DESCRIBE FUNCTION EXTENDED xpath_short ;
'tab_name'
'xpath_short(xml, xpath) - Returns a short value that matches the xpath expression'
'Example:'
' > SELECT xpath_short('12','sum(a/b)') FROM src LIMIT 1;'
' 3'
4 rows selected
>>>
>>> SELECT xpath_short ('this is not a number', 'a') FROM src LIMIT 1 ;
'_c0'
'0'
1 row selected
>>> SELECT xpath_short ('this 2 is not a number', 'a') FROM src LIMIT 1 ;
'_c0'
'0'
1 row selected
>>> SELECT xpath_short ('200000000040000000000', 'a/b * a/c') FROM src LIMIT 1 ;
'_c0'
'-1'
1 row selected
>>> SELECT xpath_short ('try a boolean', 'a = 10') FROM src LIMIT 1 ;
'_c0'
'0'
1 row selected
>>> SELECT xpath_short ('1248', 'a/b') FROM src LIMIT 1 ;
'_c0'
'1'
1 row selected
>>> SELECT xpath_short ('1248', 'sum(a/*)') FROM src LIMIT 1 ;
'_c0'
'15'
1 row selected
>>> SELECT xpath_short ('1248', 'sum(a/b)') FROM src LIMIT 1 ;
'_c0'
'7'
1 row selected
>>> SELECT xpath_short ('1248', 'sum(a/b[@class="odd"])') FROM src LIMIT 1 ;
'_c0'
'5'
1 row selected
>>> !record