Guest User

Untitled

a guest
Oct 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. SELECT (lastname || ', ' || firstname) as fullname
  2. FROM users
  3. WHERE {some condition}
  4.  
  5. -- result --
  6. fullname
  7. Anderson, Alex
  8. Baker, Bob
  9. Clark, Carl
  10.  
  11. SELECT LISTAGG(fullname, '; ') WITHIN GROUP (ORDER BY fullname) as instructors
  12. FROM
  13. (
  14. SELECT (lastname || ', ' || firstname) as fullname
  15. FROM users
  16. WHERE {some condition}
  17. )
  18.  
  19. -- desired result --
  20. instructors
  21. Anderson, Alex; Baker, Bob; Clark, Carl
  22.  
  23. -- actual result --
  24. Error Type: System.Xml.XmlException
  25. Error Message: hexadecimal value 0x00, is an invalid character. Line 1, position 32.
  26.  
  27. SELECT LISTAGG(fullname, '; ') WITHIN GROUP (ORDER BY fullname) as instructors
  28. FROM
  29. (
  30. SELECT (pk1 || ', ' || pk1) as fullname -- pk1 is the users primary key
  31. FROM users
  32. WHERE {some condition}
  33. )
  34.  
  35. -- result --
  36. instructors
  37. 01, 01; 02, 02; 03, 03
Add Comment
Please, Sign In to add comment