Direct database query - Array as an statement arg
Options
![loribas](https://us.v-cdn.net/6037124/uploads/userpics/BFKE1JGJVKM1/nDCZ50LWCIHE6.jpg)
loribas
Member ✭
I´m having trouble to set an integer array as an statement arg to a direct database query
Array:
SQL:
Args:
Error:
The same SQL query without the args works:
Best Answer
-
You need to format the array (seen as a string) as an array. So we need to deconstruct it, and recombine it, and cast to an int:
ANY(string_to_array(trim(both '[]' from ?), ',')::int[]);
Answers
-
Thank you !
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback