oracle 向存储过程发送参数- PLS-00049

kadbb459  于 2023-05-16  发布在  Oracle
关注(0)|答案(1)|浏览(136)
create or replace PROCEDURE TABULA.GetTorimByDoctor (
   DOCTORID IN CHAR,
   CUSTOMERID IN CHAR,
   DEFTYPE IN CHAR,
   p_out_rec        OUT sys_refcursor
) AS
BEGIN
   SELECT
    to_date(TO_DATE('01-01-1988 00:00', 'dd-mm-yyyy hh24:mi') + numtodsinterval(w.curdate, 'minute'),'dd-mm-yyyy') AS qdate,
    to_char(trunc(sysdate) + h.stime / 24 / 60, 'hh24:mi') AS stime,
    to_char(trunc(sysdate) +(h.stime +(
        CASE
            WHEN((macdent$mac_cyaskill.durdef <> 0)) THEN
                (macdent$mac_cyaskill.durdef)
...

我得到一个错误

LINE/COL  ERROR
--------- -------------------------------------------------------------
80/27     PLS-00049: 'DOCTORID'  bad bind variable
126/27    PLS-00049: 'CUSTOMERID' bad bind variable
127/23    PLS-00049: 'DEFTYPE'  bad bind variable
Errors: check compiler log
7rtdyuoh

7rtdyuoh1#

谁知道呢,你没有发布完整的代码,但是我怀疑你在过程中在参数名前面加了一个冒号(第80、126、127行)。
下面是你(可能)做的一个例子:

SQL> CREATE OR REPLACE PROCEDURE gettorimbydoctor (doctorid IN CHAR)
  2  AS
  3     l_cnt  NUMBER;
  4  BEGIN
  5     SELECT COUNT (*)
  6       INTO l_cnt
  7       FROM DUAL
  8      WHERE 'a' = :doctorid;         --> colon here
  9  END;
 10  /

Warning: Procedure created with compilation errors.

SQL> show err
Errors for PROCEDURE GETTORIMBYDOCTOR:

LINE/COL ERROR
-------- -----------------------------------------------------------------
8/17     PLS-00049: bad bind variable 'DOCTORID'
SQL>

如果是这样,删除冒号:

SQL> CREATE OR REPLACE PROCEDURE gettorimbydoctor (doctorid IN CHAR)
  2  AS
  3     l_cnt  NUMBER;
  4  BEGIN
  5     SELECT COUNT (*)
  6       INTO l_cnt
  7       FROM DUAL
  8      WHERE 'a' = doctorid;
  9  END;
 10  /

Procedure created.

SQL>

相关问题