DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Problem with SELECT UNION

  1. #1
    Join Date
    Jan 2002
    Posts
    22
    Hi , I need a solution for this problem

    Select A from Table1
    Union
    Select B from Table2
    ;
    Where A and B are Number(2) , but
    Oracle returns a Number(38)
    i need return a number(2) ?

    Thanks.


  2. #2
    Join Date
    Oct 2001
    Location
    Madrid, Spain
    Posts
    763
    If the columns are the same in both tables try with:

    select A from table A
    union all
    select B from table B

    Columns must the named equal too.

    Hope that helps

    Angel

  3. #3
    Join Date
    Jan 2002
    Posts
    22

    Not is a valid solution

    Not is a valid solution,
    oracle returns a
    number(38)
    but no a number(2)

  4. #4
    Join Date
    Jun 2001
    Location
    Helsinki. Finland
    Posts
    3,938

    > Oracle returns a Number(38)

    How did you come to that conclusion?



  5. #5
    Join Date
    Jan 2002
    Posts
    22

    The conclusion

    Oracle return the greastest size of number
    in select union.

  6. #6
    Join Date
    Oct 2001
    Location
    Madrid, Spain
    Posts
    763
    But in your first post you said in both tables this column is number(2). Then could us explain how oracle returns number(38)?


  7. #7
    Join Date
    Jan 2002
    Posts
    22

    The Problem is

    Select A from table1
    Union
    Select B from table2
    Where A and B are number(2)

    if the query is
    Select A from table1
    Oracle returns the type of column --> number(2)

    but in the Select Union :

    Select A from table1
    Union
    Select B from table2

    is equal to

    Select number from table1
    Union
    Select number from table2

    and the results is a number with the most size
    number(38) and no the type of the column
    number(2).




  8. #8
    Join Date
    Jun 2001
    Location
    Helsinki. Finland
    Posts
    3,938

    Re: The Problem is

    I am sorry, I am lost here... I don't understand how you figure out that the returned size is 38.




  9. #9
    Join Date
    Oct 2001
    Location
    Madrid, Spain
    Posts
    763
    I donĀ“t understand neither sorry

  10. #10
    Join Date
    Dec 2001
    Location
    Brazil
    Posts
    282



    Are you sure it's oracle you're using? Isn't it Ms Access?

    F.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width