नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
Applies to:
Databricks SQL
Databricks Runtime
Returns an error if expr is not true.
Syntax
assert_true(condition [, message])
Arguments
condition: ABOOLEANexpression.message: An optionalSTRINGexpression with a message. The default is'<condition>' is not true!.
Returns
An untyped NULL if no error is returned.
Applies to:
Databricks SQL
Databricks Runtime 14.2 and above
The returned error condition is USER_RAISED_EXCEPTION and the SQLSTATE is P0001.
See Handling error conditions for details on handling error conditions.
Examples
> SELECT assert_true(0 < 1);
NULL
> SELECT assert_true(0 > 1);
[USER_RAISED_EXCEPTION] '0 > 1' is not true! SQLSTATE: P0001
> SELECT assert_true(1 = 2, 'One is not two!');
[USER_RAISED_EXCEPTION] One is not two! SQLSTATE: P0001