1. Scott Roberts
  2. Valentina Database ADK
  3. 日, 7月 22 2018, 09:44 PM
  4.  メールで購読
Is it possible to use an array variable in a stored procedure? The SQL Editor lets me create the following DECLARE statement but I am unable to determine how to set or get the elements of the array.


DECLARE v_days_of_week BOOLEAN[7];

-- This line returns NULL
PRINT v_days_of_week[2];

-- This line causes Kernel error: 0x71000. unexpected token v_days_of_week
SET v_days_of_week[2] = TRUE;

-- This line causes Kernel error: 0xa000. "Getting expression from value of ARRAY type" is not supported.
SET v_days_of_week = ARRAY[false,true,false,false,false,false,false];


I'm wondering if it is possible to retrieve an array field from a table and store it in a variable. All of the examples for Array functions in the documentation use literals for the array values (and none of them stores the array in a variable). I'm hoping that I can retrieve an array from a table and then loop through the array in a stored procedure. I'm also hoping that I can put the value of another variable into an element of an array.

My workaround thus far is to concatenate the elements of the array into a comma-delimited string and use the List... functions to access the elements. I'm wondering if there is another (better) way to do this.
コメント
There are no comments made yet.
Ivan Smahin 承諾済みの回答
I will check it today.
コメント
There are no comments made yet.
Ivan Smahin 承諾済みの回答
There are few fixes for working with array type in stored procedures/triggers and so on ...
Will be available in the next build (v.8.3.8).

There is a new SQL function - "Array array_set( inArray, inIndex, inValue )". The assign (=) operator will be available later as a "syntax sugar" over that function.
コメント
There are no comments made yet.
  • ページ :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories