简体   繁体   English

如何在SAP HANA中的表中插入数组值

[英]how to insert array values in a table in SAP HANA

Here i'm trying to insert array values into the table. 在这里,我试图将数组值插入表中。

below code shows my work: 下面的代码显示了我的工作:

CREATE COLUMN TABLE  "KABIL_PRACTICE"."Array_Insert"
(
"Id" integer,
"Dept_Id" integer array
);

INSERT INTO "KABIL_PRACTICE"."Array_Insert" VALUES( 3, array
(2,3,5,6));

But it results looks like: 但是结果看起来像:

|Id| Dept_Id |

|3 |040000000102000000010300000001050000000106000000 |

I can't understand what is the meaning of above values in "Dept_Id" column... 我无法理解“ Dept_Id”列中上述值的含义...

but I want to see my table original values like: 但我想查看表格的原始值,例如:

|Id| Dept_Id |

|3| 2 |

|?| 3 |

|?| 5 |

|?| 6 |

The topic of "array"-insert in SAP HANA has been extensively discussed here on SO. SAP SOA中的“数组”插入主题已在此处进行了广泛讨论。 Please do the search for yourself on that. 请自己搜索。

However, your expected result rather looks as if you want to perform a bulk insert of many records. 但是,您的预期结果看起来好像您要执行许多记录的批量插入。 That's different to an ARRAY insert, where the array is the value of one of the columns for a single record. 这与ARRAY插入不同,在ARRAY插入中,数组是单个记录的列之一的值。

If you actually have multiple records to deal with (eg in a JAVA array or collection), then what you can do is to loop over all elements and add them one by one to a single bulk statement (aka batch statement). 如果您实际上有多个记录要处理(例如,在JAVA数组或集合中),那么您可以做的是遍历所有元素,并将它们一个接一个地添加到单个批量语句(即批处理语句)中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM