Oracle給我的錯誤「ORA-06502:PL/SQL:數字或值錯誤:字符到數字轉換錯誤ORA-06512:在行15 06502. 00000 - 」PL/SQL:數字或值錯誤%的」PL/SQL - 數值或值錯誤
DECLARE
idnumber NUMBER(10);
initials VARCHAR2(100);
userid VARCHAR2(100);
old_initials VARCHAR2(100);
CURSOR cursor1 IS
SELECT s_first, s_last FROM tst_student ORDER BY s_first;
student cursor1%ROWTYPE;
BEGIN
FOR student IN cursor1 LOOP
idnumber :=1;
old_initials := SUBSTR(student.s_first,1,1) || SUBSTR(student.s_last,1,1);
initials := SUBSTR(student.s_first,1,1) || SUBSTR(student.s_last,1,1);
IF initials = old_initials THEN
userid := old_initials || '00' || idnumber + 1;
ELSE idnumber := 1;
END IF;
DBMS_OUTPUT.PUT_LINE(userid);
END LOOP;
END;
它抱怨該生產線是用戶ID:= old_initials || '00' ||的IDNumber + 1;
由於
謝謝,這個固定我的錯誤,但它仍然沒有增加我的價值。我試圖讓它爲用戶分配用戶名。它只是給每個人分配001。 – user1834591