0
我做了這個pl sql函數來檢索xml格式的oracle數據。 但我得到這個錯誤: PL/SQL:ORA-00932:不一致的數據類型:預期CLOB了 -如何解決PL/SQL:ORA-00932:不一致的數據類型:預計的CLOB得到 -
這裏是我的PL SQL代碼:
create or replace PACKAGE PAYROLL AS
FUNCTION get_all_payroll_transactions return clob;
END PAYROLL;
FUNCTION get_all_payroll_transactions return clob IS
ret clob;
BEGIN
SELECT XMLElement("transaction", //this line shows error
XMLElement("salary_year", SALYR),
XMLElement("salary_month", SALMT),
XMLElement("employee_id", EMPID),
XMLElement("department_code", DPTID),
XMLElement("salary_head", SALHD),
XMLElement("description", DESCRP),
XMLElement("amount", ALAMT),
XMLElement("operator_id", OPID),
XMLElement("transaction_date", TRADT)
) AS clob into ret FROM PAYROLLFILE;
COMMIT;
RETURN '<result><status affectedRow='||ret||'>success</status></result>';
EXCEPTION
WHEN OTHERS THEN
RETURN '<result><status>Error</status></result>';
END get_all_payroll_transactions;
我想可能會有一些CLOB ,xml強制轉換問題。 請幫我。謝謝
這類似於你的[較早前的問題(http://stackoverflow.com/questions/34585043/how-to-fix-error34-26-pl-sql-ora-00932-inconsistent -datatypes預期-CHA)。你似乎仍然有同樣的問題。 –
是的,請幫忙@Tim Biegeleisen – user5005768
我認爲你在嘗試投射時處於正確的軌道,但不應該在最外面的'XMLElement'周圍放置括號嗎? –