function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
buggs sfdcbuggs sfdc 

convert text to integer in SOQL

HI guys

Can anyone can help me out:

-How to convert text to integer in SOQL.

Really appreciate quick response
Best Answer chosen by buggs sfdc
Srinivas SSrinivas S
String num = '5';
system.debug([SELECT name from Account limit: Integer.valueOf(num)]);

------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.

All Answers

Srinivas SSrinivas S
String num = '5';
system.debug([SELECT name from Account limit: Integer.valueOf(num)]);

------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
This was selected as the best answer
buggs sfdcbuggs sfdc
Thank you so much.
But this is something which am quering in tool(SOQLX) soql not in apex,is there any way in soql to type cast it?
Srinivas SSrinivas S
In tool, we have some limitation to use dynamic values. Since tool is only for our query paln how it is bahaving.

Execute in Anonymous block and print it and analyse the results.

Thanks,
Srinivas
- Please mark as solution if your problem is resolved.