1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SalesforceのSOQLで数値条件値として2^31を指定するとエラーになる

Posted at

整数の形式で2^31以上を指定すると落ちます。
エラーメッセージわかりづらい(Javaのメッセージそのままだし、むしろわかり易いのか?)。

$ force query SELECT Amount FROM Opportunity WHERE Amount = 2147483648
FROM Opportunity WHERE Amount = 2147483648
                                ^
ERROR at Row:1:Column:43
For input string: "2147483648"

条件値が整数っぽかったら内部でとりあえずIntegerとして変換かけようとしてその範囲外だとエラーになるのでしょうね。
.0をつけるか、Apexなら(Integer以外の)変数にして埋め込むことで回避できます。

$ force query SELECT Amount FROM Opportunity WHERE Amount = 2147483648.0
 Amount          
-----------------
 2.147483648e+09 
 (1 records)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?