pl / sql函数显示语法错误

时间:2016-01-02 11:46:17

标签: plsql

我是pl / sql的新手。我已经使用sql developer编写了一个pl / sql函数 包名&体。

我的功能显示此错误:

图片如下:

enter image description here

这是pl / sql代码:

  create or replace PACKAGE  PAYROLL AS
            FUNCTION save_payroll_transaction(transaction_data NVARCHAR2 ) RETURN nclob;
END PAYROLL;        

体:

 create or replace PACKAGE BODY PAYROLL IS 
       FUNCTION save_payroll_transaction(transaction_data NVARCHAR2 ) RETURN nclob IS ret nclob;
       xmlData XMLType;
       BEGIN 
       xmlData:=XMLType(transaction_data);
       INSERT INTO PAYROLLFILE SELECT x.* FROM XMLTABLE('/transaction'
                                                    PASSING xmlData
                                                    COLUMNS "salary_year"       NUMBER(4,0)     PATH  "SALYR",
                                                            "salary_month"      NUMBER(2,0)     PATH  "SALMT",
                                                            "employee_id"       NUMBER            PATH  "EMPID",
                                                            "department_code" NUMBER        PATH  "DPTID",
                                                            "salary_head"       VARCHAR2(2)     PATH  "SALHD",
                                                            "description"       VARCHAR2(50)    PATH  "DESCR",
                                                            "amount"                FLOAT(126)      PATH  "ALAMT",
                                                            "operator_id"       NUMBER        PATH  "OPID",
                                                            "transaction_date" DATE           PATH  "TRADT") x;


         ret:=to_char(sql%rowcount);
    COMMIT;

    RETURN '<result><status affectedRow='||ret||'>success</status></result>';
    EXCEPTION
    WHEN OTHERS THEN
    RETURN '<result><status>Error</status></result>';

    END save_payroll_transaction;

    END PAYROLL;

请帮忙。谢谢

1 个答案:

答案 0 :(得分:2)

XML路径是一个字符串,而不是标识符,因此您需要将其括在单引号中:

client_id