cancel
Showing results for 
Search instead for 
Did you mean: 

SQL call function with 2 args

ekallivrousis
New Contributor III

I have a function which takes 2 arguments. Ill write some pseudo code for an idea

f:{[x;y] $[x~`1;y;`0]}

Then i have a table:

t:([]a:`1`2`3;b:`4`5`6)

Now i want to call that function and pass a and b to it from an update statement

update c:f[a;b] from t;

update c:f[a;b] from t;

This however doesnt work because its passing the whole column instead of just an item. Now i know if it was just 1 arg i could just do an "each" but I'm not sure how to do that with 2 args.

1 ACCEPTED SOLUTION

willlowe
New Contributor

You're right in using an each iterator, by using:

update c:f'[a;b] from t
a b c
-----
1 4 4
2 5 0
3 6 0

View solution in original post

2 REPLIES 2

willlowe
New Contributor

You're right in using an each iterator, by using:

update c:f'[a;b] from t
a b c
-----
1 4 4
2 5 0
3 6 0

That worked!

 

Thank you