这是一段代码:
CREATE OR REPLACE PROCEDURE ADD_GOOD (
P_GOOD_NAME IN VARCHAR2,
P_CLIENT_ID IN NUMBER,
P_GOOD_PRICE IN NUMBER,
P_GOOD_DATE IN DATE DEFAULT NULL
)
IS
CUR_ID NUMBER(8);
BEGIN
DBMS_OUTPUT.PUT_LINE('ЕСТЬ!');
/* Commented code */
END ADD_GOOD;
执行此操作时:
EXECUTE ADD_GOOD('some text...', 28, 920);
EXECUTE ADD_GOOD('some text...', 28, 2400.00, '08.01.2018');
我收到错误:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 1
06502. 00000 - "PL/SQL: numeric or value error%s"
为什么呢?我认为数字支持整数和浮点值?
答案 0 :(得分:-1)
varchar '08 .01.2018'中的日期,浮动没有问题。
DECLARE
PROCEDURE ADD_GOOD (
P_GOOD_NAME IN VARCHAR2,
P_CLIENT_ID IN NUMBER,
P_GOOD_PRICE IN NUMBER,
P_GOOD_DATE IN DATE DEFAULT NULL
)
IS
CUR_ID NUMBER(8);
BEGIN
DBMS_OUTPUT.PUT_LINE('ЕСТЬ!');
/* Commented code */
END ADD_GOOD;
BEGIN
ADD_GOOD('some text...', 28, 920);
ADD_GOOD('some text...', 28, 2400.00, SYSDATE);
END;
/
答案 1 :(得分:-1)
EXECUTE ADD_GOOD('some text...', 28, 2400.00, to_date('08-Jan-2018'));
会奏效。你需要将你的字符串转换为日期
numeric or value error: character to number conversion error
错误通常在投射失败时出现