Oracle 9i環境運行10g下的sql指令碼出現不相容的問題

來源:互聯網
上載者:User

在Oracle 10g環境中運行沒有任何問題,如下:

FOR C IN (SELECT * FROM TABLE(PKG_CMD_COMMON.F_SPLIT(P_IN_IDS_, ','))) LOOP
。。。。此處省略
END LOOP;

但在Oracle 9i執行中,會莫名其妙地報錯 ORA-22905: cannot access rows from a non-nested table item無法從非巢狀表格項訪問行。

分析:

包pkg_cmd_common中的函數f_split返回的是type類型的自訂的數組type_varchar_array

在網上查知:oracle9i下需要cast轉換

FOR C IN (SELECT * FROM TABLE(CAST(PKG_CMD_COMMON.F_SPLIT(P_IN_IDS_, ',') AS TYPE_VARCHAR_ARRAY))) LOOP
。。。。此處省略
END LOOP;

重新編譯後不再報錯,至此問題解決,在這裡記錄下。

相關文章

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.