Forum Stats

  • 3,770,444 Users
  • 2,253,115 Discussions
  • 7,875,457 Comments

Discussions

how to solve this error

Aravind Kumar Sekar
Aravind Kumar Sekar Member Posts: 27
edited Oct 24, 2015 2:37PM in SQL and PL/SQL (Portuguese)

TABLE

EMP

TableColumnData TypeLengthPrecisionScalePrimary KeyNullableDefaultComment
EMPEMPNONUMBER-401---
ENAMEVARCHAR210---nullable--
JOBVARCHAR29---nullable--
MGRNUMBER-40-nullable--
HIREDATEDATE7---nullable--
SALNUMBER-372-nullable--
COMMNUMBER-72-nullable--
DEPTNONUMBER-20-nullable-

the program i am executing is

DECLARE

E_NAME EMP.ENAME%TYPE;

E_MGR EMP.MGR%TYPE;

E_SAL EMP.SAL%TYPE;

CURSOR E_CUR IS

SELECT ENAME,MGR,SAL FROM EMP;

BEGIN

OPEN E_CUR;

DBMS_OUTPUT.PUT_LINE(E_NAME||' '|| E_MGR||' '||E_SAL);

LOOP

FETCH E_CUR INTO E_NAME,E_SAL,E_MGR;

IF E_SAL> 2000 THEN

UPDATE EMP SET SAL=SAL/1000 ;

DBMS_OUTPUT.PUT_LINE(E_NAME||' | '|| E_MGR||' | '||E_SAL);

EXIT  WHEN E_CUR%NOTFOUND;

END IF;

END LOOP;

END

EMPNOENAMEJOBMGRHIREDATESALCOMMDEPTNO
7839KINGPRESIDENT-11/17/198121500-10
7698BLAKEMANAGER783905/01/198119350-30
7782CLARKMANAGER783906/09/198118950-10
7566JONESMANAGER783904/02/198119475-20
7788SCOTTANALYST756612/09/198219500-20
7902FORDANALYST756612/03/198119500-20
7369SMITHMANAGER790212/17/198016501-20
7499ALLENSALESMAN769802/20/19811810030030
7521WARDSALESMAN769802/22/19811775050030
7654MARTINSALESMAN769809/28/198117750140030
7844TURNERSALESMAN769809/08/198118000030
7876ADAMSCLERK778801/12/198317600-20
7900JAMESCLERK769812/03/198117450-30
7934MILLERCLERK778201/23/198217800-10

the error i was getting is

ORA-06502: PL/SQL: numeric or value error: number precision too large

Tagged:

Best Answer

Answers