Is there any way to store variable length list into database in SQL or any other database engine ??
Here list means no. of elements in the array. For e.g. an array of numbers.
But in my actual application things to be stored are objects and hence cannot be stored simply as comma separated list.
Variable length refers to anything whose length can vary. For example, in databases, a variable-length field is a field that does not have a fixed length. Instead, the field length varies depending on what data is stored in it.
Fixed length means having a set length that never varies. In database systems, a field can have a fixed or a variable length. A variable-length field is one whose length can be different in each record, depending on what data is stored in the field.
There are two kinds of strings: variable-length and fixed-length strings. A variable-length string can contain up to approximately 2 billion (2^31) characters. A fixed-length string can contain 1 to approximately 64 K (2^16) characters.
CHAR is conceptually a fixed-length, blank-padded string. Trailing blanks (spaces) are removed on input, and are restored on output. The default length is 1, and the maximum length is 65000 octets (bytes). VARCHAR is a variable-length character data type.
Some SQL databases support the ARRAY type as the type of a column. An ARRAY is variable length and can hold objects of the same type. See details below which apply to databases that support the SQL Standard:
http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#N106FE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With