diff --git a/src/sql/engine/expr/ob_expr_xml_element.cpp b/src/sql/engine/expr/ob_expr_xml_element.cpp index 774ad0721d..34fc9901e1 100644 --- a/src/sql/engine/expr/ob_expr_xml_element.cpp +++ b/src/sql/engine/expr/ob_expr_xml_element.cpp @@ -41,6 +41,10 @@ int ObExprXmlElement::calc_result_typeN(ObExprResType& type, if (OB_UNLIKELY(param_num < 3)) { ret = OB_ERR_PARAM_SIZE; LOG_WARN("invalid param number", K(ret), K(param_num)); + } else if (!is_called_in_sql()) { + ret = OB_ERR_SP_LILABEL_MISMATCH; + LOG_WARN("expr call in pl semantics disallowed", K(ret), K(N_XML_ELEMENT)); + LOG_USER_ERROR(OB_ERR_SP_LILABEL_MISMATCH, static_cast(strlen(N_XML_ELEMENT)), N_XML_ELEMENT); } else { // check opt_escaping if (!ob_is_integer_type(types_stack[0].get_type())) { diff --git a/src/sql/engine/expr/ob_expr_xmlparse.cpp b/src/sql/engine/expr/ob_expr_xmlparse.cpp index 11ba37783f..988f095c98 100644 --- a/src/sql/engine/expr/ob_expr_xmlparse.cpp +++ b/src/sql/engine/expr/ob_expr_xmlparse.cpp @@ -41,6 +41,10 @@ int ObExprXmlparse::calc_result_typeN(ObExprResType &type, if (OB_UNLIKELY(param_num != 4)) { ret = OB_ERR_PARAM_SIZE; LOG_WARN("invalid param number", K(ret), K(param_num)); + } else if (!is_called_in_sql()) { + ret = OB_ERR_SP_LILABEL_MISMATCH; + LOG_WARN("expr call in pl semantics disallowed", K(ret), K(N_XMLPARSE)); + LOG_USER_ERROR(OB_ERR_SP_LILABEL_MISMATCH, static_cast(strlen(N_XMLPARSE)), N_XMLPARSE); } else { // param 0 indicate type is document or content // param 1 is xml text for parsing