2012/7/6 Pavel Stehule :
> 2012/7/6 ChoonSoo Park :
>> It works!
>>
>> One more question.
>> Do I have to use CAST for parameter value holder?
>
you can cast array to int array
string_to_array(..., ',')::int[]
Regards
Pavel
> probably
>
> all values in array should to share one type, and when
2012/7/6 ChoonSoo Park :
> It works!
>
> One more question.
> Do I have to use CAST for parameter value holder?
probably
all values in array should to share one type, and when this type is
not same like holder, then you need cast
Regards
Pavel
>
> employee table's dept_id and salary columns ar
It works!
One more question.
Do I have to use CAST for parameter value holder?
employee table's dept_id and salary columns are integer types.
RETURN QUERY EXECUTE 'SELECT * FROM employee WHERE dept_id = $1[1] and
salary <= $1[2]' using tmpArrayValues;
When I use text array, it complains:
ERROR:
Hello
2012/7/6 ChoonSoo Park :
> Inside a function, I can execute dynamic query like this
>
> dept_id = 1;
> salary = 5;
> RETURN QUERY EXECUTE 'SELECT * FROM employee WHERE dept_id = $1 and
> salary >= $2' using dept_id, salary;
>
> When the query condition is dynamically ge
Inside a function, I can execute dynamic query like this
dept_id = 1;
salary = 5;
RETURN QUERY EXECUTE 'SELECT * FROM employee WHERE dept_id = $1 and
salary >= $2' using dept_id, salary;
When the query condition is dynamically generated and number of parameters
is also dynam