INSERT INTO ..VALUES (SQLERRM, SQLCODE, SYSDATE) doesn't work?
534121Sep 16 2006 — edited Sep 25 2006Hi,
There is a procedure, in its exception I have used
INSERT INTO TERR VALUES (SQLCODE||SQLERRM, SYSDATE);
This is to capture the exceptions in TERR table (ERR_DESC VARCHAR2(3000), ERR_TIME DATE).
This procedure compiles sccuessfully in database A, but throws error "ORA-00984: column not allowed here"
I learnt that SQLCODE,SQLERRM doesn't work directly in a SQL. We have to use variables to store them.
My Question is, why the procedure (with same code) compiles successfully in database A.
Is there any set-up that has been missed in database B (OR)
is there any post-db creation scripts that have been missed out in database A (where it is successful)?
Procedure goes like this:-
CREATE PROCEDURE PRO_DATA
(vval1 IN NUMBER, vval2 IN VARCHAR2....vval5 IN DATE) IS
BEGIN
INSERT INTO TBL_INVALID (col1, col2, ...col5)
VALUES (vval1,vval2,...val5);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
INSERT INTO TERR (ERROR_DESC, ERROR_TIME)
VALUES (SQLCODE || SQLERRM, SYSDATE);
COMMIT;
END PRO_DATA;