Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: datatype

Re: datatype

From: Stephan Langer <slanger_at_dixi-wc.de>
Date: Mon, 15 Jan 2001 10:40:17 +0100
Message-ID: <3A62C580.89E496F9@dixi-wc.de>

Hi Christopher,

what about changing the order of the two selects. AFAIK in the first select of an union alle columns must have defined types (i.e. not NULL) (and names?).

hth
Stephan

Christopher schrieb:

> I got "ORA-01790: expression must have same datatype as corresponding
> expression"
> when executing the following SQL statment :
>
> select A.gpm_ent_id_group A_id
> ,NULL B_id
> from GroupMember A
> where A.gpm_ent_id_member = 6
> UNION
> select A.gpm_ent_id_group A_id
> ,B.gpm_ent_id_group B_id
> from GroupMember A, GroupMember B
> where A.gpm_ent_id_member = 6
> and A.gpm_ent_id_group = B.gpm_ent_id_member ;
>
> p.s. Both gpm_ent_id_member and gpm_ent_id_group are NUMBER(38)
>
> So I modify the SQL to :
>
> select A.gpm_ent_id_group A_id
> ,to_number(NULL) B_id
> from GroupMember A
> where A.gpm_ent_id_member = 6
> UNION
> select A.gpm_ent_id_group A_id
> ,B.gpm_ent_id_group B_id
> from GroupMember A, GroupMember B
> where A.gpm_ent_id_member = 6
> and A.gpm_ent_id_group = B.gpm_ent_id_member ;
>
> However, it is not an ANSI SQL. Is there any ANSI solution for this
> situation?
>
> Thanks.
  Received on Mon Jan 15 2001 - 03:40:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US