Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

INSERT INTO ..VALUES (SQLERRM, SQLCODE, SYSDATE) doesn't work?

534121Sep 16 2006 — edited Sep 25 2006
Hi,

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;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 23 2006
Added on Sep 16 2006
19 comments
21,698 views