Есть ли целочисленные диапазоны для оператора Where?

Я получил эту проблему после обновления до Android Studio 2.3

Добавление этих строк в зависимости решило мою проблему

compile 'com.android.support:customtabs:25.2.0'  
compile 'com.android.support:palette-v7:25.2.0'
9
задан Davis Broda 19 June 2018 в 04:50
поделиться

5 ответов

Конечно, вы можете сделать это:

select * from table where (col1 / col2 ) in (1,2,3,4,5,6,7,8);

или

select * from table where (col1 / col2 ) between 1 and 8
and mod (col1 , col2 ) = 0;
10
ответ дан 3 November 2019 в 01:03
поделиться

How about

select * 
from table
where (col1 / col2 ) BETWEEN 1 AND 8
  and (col1 / col2 ) = FLOOR(col1 / col2 )

This simply checks if the fraction is in the interval, and integer.

1
ответ дан 3 November 2019 в 01:03
поделиться

You could cast it from float to int and use between. (You might want to make a virutal/computed column depending on the query's performance.)

0
ответ дан 3 November 2019 в 01:03
поделиться

To test col1/col2 is an integer, you could Mod them together...

Where (col1/col2) = (col1\col2) and (col1/col2) between 1 and 8

0
ответ дан 3 November 2019 в 01:03
поделиться

You can use pipeline function to generate integer range.

create or replace type my_number_collection is table of number;

create or replace function
  gen_range (p_from in number, p_to in number)
  return my_number_collection
  PIPELINED
  as
  begin
    for i in p_from..p_to loop
      pipe row(i);
    end loop;
    return;
  end;
/

select *
from my_table 
where col1/col2 in (select column_value from table(gen_range(1,8)));
0
ответ дан 3 November 2019 в 01:03
поделиться
Другие вопросы по тегам:

Похожие вопросы: