Inconsistent datatypes: expected-got CLOB error example

Source: Internet
Author: User

Inconsistent datatypes: expected-got CLOB error example

The tester reported that an SQL statement can be executed normally in one of the test environments, but cannot be executed in another test environment. The error is:

ORA-00932: inconsistent datatypes: expected-got CLOB.

I started to check whether there is a CLOB field in the table, but I checked the related table structure. There are no CLOB, BLOB, and other types of fields. Next, I analyzed the SQL, which caught my attention. In this SQL, The WMSYS. WM_CONCAT function is used. You can view the definition of this function in two test environments and find the difference:

Execute the correct WM_CONCAT definition for the database:

SQL> desc wmsys. wm_concat FUNCTION wmsys. wm_concat RETURNS VARCHAR2 Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P1 VARCHAR2 IN

WM_CONCAT definition of the database for which an exception is executed:

SQL> desc wmsys. wm_concat FUNCTION wmsys. wm_concat RETURNS CLOB Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P1 VARCHAR2 IN

The return values of these two functions are different! When the library with the execution error returns CLOB, it is no wonder that the inconsistent datatypes: expected-got CLOB error will be reported. But why? Go to metalink to find the answer.

WM_CONCAT is used as the keyword to search for this article [ID 1300595.1. Oracle explains that WM_CONCAT is an internal function in Workspace Manager and may vary with different database versions. In 10.2.0.4/11.1.0.7/11.2.0.1, WM_CONCAT returns VARCHAR2, while in 10.2.0.5/11.2.0.2, the returned value is CLOB. Therefore, the function definitions of the two databases are different. Therefore, Oracle does not recommend the use of internal functions such as WM_CONCAT (internal undocumentd function), and Oracle is not responsible for the loss caused by the use of such functions, in addition, changes to such functions will not be notified to users. Therefore, you must think twice before using such functions!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.