-
MikeAtkinson
- Contributor
- Offline
- Posts: 185
- Joined: Wed May 29, 2013 2:10 pm
- Location: Bracknell
-
MikeAtkinson
- Contributor
- Offline
- Posts: 185
- Joined: Wed May 29, 2013 2:10 pm
- Location: Bracknell
Kognitio Console issues, advice, etc.
Why does $tab[1] fail to compile
by MikeAtkinson » Wed Aug 31, 2016 2:27 pm
I was trying to use a value from a Lua table in an SQL predicate but it errors, complaining about concatenating a table value. I made a small example here of what doesn’t work:
Code: Select all
tab = {5,6}
select value from values between 1 and 10
where value < $tab[1];
Re: Why does $tab[1] fail to compile
by MikeAtkinson » Wed Aug 31, 2016 2:28 pm
This is because Kog script interprets the select statement as:
It should be:
Anything within $( ) is interpreted as a Lua expression, so it is now interpreted as:
Code: Select all
sql("select value from values between 1 and 10 where value < " .. tab .. "[1]");
Code: Select all
tab = {5,6}
select value from values between 1 and 10 where value < $(tab[1]);
Code: Select all
sql("select value from values between 1 and 10 where value < " .. tab[1] );
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest