Hi,

The following should work for an empty, and single element array:

  select ();
  select (1,);

But I agree it looks like a hack.

Regards,
Thomas


On Mon, May 4, 2015 at 12:07 PM, <[email protected]> wrote:

> Hi Noel,
>
> your suggestion leads to the same result as cast (1 as ARRAY), the type of
> the array element is VARCHAR, not INTEGER. (tested with 1.3.176 and 1.4.187)
> The following query's ResultSetMetaData shows the problem:
>
> *SELECT **ARRAY_GET**(**CAST**(**CAST**( **1 **AS **INTEGER**) **AS *
> *ARRAY**)*, *1**)*, *ARRAY_GET**((**1*,*2**)*, *1**)*
>
> Kind regards,
>
> Christoff Schmitz
>
> F I N A R I S
> Financial Software Partner GmbH
> Sömmerringstrasse 23
> 60322 Frankfurt am Main
>
> Fon:      +49 (0)69  / 254 98 - 24
> Mobile: +49 (0)176 / 206 34 186
> Fax:       +49 (0)69  / 254 98 - 50
> eMail:    mailto:[email protected]
> <[email protected]>
> www:      http://www.finaris.de und http://www.rapidrep.com
>
>
>
> From:        Noel Grandin <[email protected]>
> To:        [email protected]
> Date:        2015-05-04 11:55
> Subject:        Re: [h2] Single element array-literal?
> Sent by:        [email protected]
> ------------------------------
>
>
>
>
> SELECT CAST(CAST( 1 AS INTEGER) AS ARRAY)
>
>
> On 2015-05-04 11:44 AM, [email protected] wrote:
> > Hi,
> >
> > is there a literal form to describe an array with only 1 element?
> > For 2+ elements it works like this: *select**(**1*,*2*,*3**)*
> >
> > *select**(**1**)*does not result in SQL type ARRAY, the result type is
> INTEGER.
> > *CAST**(**1**AS**ARRAY**)*results in SQL type ARRAY, but the result is
> an array containing the String "1", not 1 as
> > numeric type
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> ================================================================================================================
> Disclaimer
> The information contained in this e - mail and any attachments ( together
> the "message") is intended for the addressee only and
> may contain confidential and/or privileged information. If you have
> received the message by mistake please delete it and notify
> the sender and do not copy or distribute it or disclose its contents to
> anyone.
>
> FINARIS Financial Software Partner GmbH, Sömmerringstr. 23, 60322
> Frankfurt/Main, Germany
> Registered at Frankfurt/Main, HRB 52873, Managing Directors: Dipl. Inf.
> Hermann Friebel, Dipl. Ing. Kai Bächle, Dipl. Inf. Werner Märkl
>
> ================================================================================================================
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to