नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
Applies to:
Databricks SQL
Databricks Runtime 14.1 and above
Call a method with reflection, returning NULL if the method returns an exception.
To return an error instead use reflect.
Syntax
try_reflect(class, method [, arg1] [, ...])
Arguments
class: ASTRINGliteral specifying the java class.method: ASTRINGliteral specifying the java method.argN: An expression with a type appropriate for the selected method.
Returns
A STRING.
Examples
> SELECT try_reflect('java.lang.Integer', 'valueOf', '1010', '2');
c33fb387-8500-4bfa-81d2-6e0e3e930df2
> SELECT try_reflect('java.util.UUID', 'fromString', 'a5cf6c42-0c85-418f-af6c-3e4e5b1328f2');
A5cf6c42-0c85-418f-af6c-3e4e5b1328f2
> SELECT try_reflect('java.util.UUID', 'IDoNotExist');
c33fb387-8500-4bfa-81d2-6e0e3e930df2
> SELECT reflect('java.lang.Integer', 'divideUnsigned',10,0);
Error
> SELECT try_reflect('java.lang.Integer', 'divideUnsigned',10,0);
NULL