Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
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