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!

i am new to pl/sql help me get to solve this error

Aravind Kumar SekarSep 16 2015 — edited Sep 16 2015

the syntax for creating the HOME table and home details

create table home (F_NAME VARCHAR2(25),M_NAME VARCHAR2(25),C_NAME VARCHAR2(25));


create table home (F_NAME VARCHAR2(25),M_NAME VARCHAR2(25),C_NAME VARCHAR2(25));

the program for trigger

CREATE OR REPLACE TRIGGER HOME_BEFORE_DELETE

BEFORE INSERT

ON HOME

FOR EACH ROW

DECLARE

V_USERNAME VARCHAR2(25);

BEGIN

SELECT USER INTO V_USERNAME FROM DUAL;

INSERT INTO HOME_DETAILS

(F_NAME, M_NAME, C_NAME  )

values

(:old.F_NAME,

:old.M_NAME,

:old.C_NAME ,V_USERNAME);

END



when executing it shows

ORA-24344: success with compilation error

This post has been answered by Manjusha Muraleedas on Sep 16 2015
Jump to Answer

Comments

Manjusha Muraleedas
Answer

Hi
Insertion to table home details is incorrect.

You specified only 3 columns F_NAME, M_NAME, C_NAME in column list and gave 4 values in value list.Please correct it.

INSERT INTO HOME_DETAILS

(F_NAME, M_NAME, C_NAME  )

values

(:old.F_NAME,

:old.M_NAME,

:old.C_NAME ,V_USERNAME);


Regards.

Manjusha

Marked as Answer by Aravind Kumar Sekar · Sep 27 2020
unknown-951199

[oracle@localhost ~]$ oerr ora 24344

24344, 00000, "success with compilation error"

// *Cause:  A sql/plsql compilation error occurred.

// *Action: Return OCI_SUCCESS_WITH_INFO along with the error code

//

John Spencer

There are other issues with your trigger in addition to the column list discrepancy.  You name the trigger HOME_BEFORE_DELETE, but define it as before insert.  The old values that you reference in the trigger body are not available in a before insert trigger.

John

UserMr

Your code should be like following:

Create tables:

create table home (F_NAME VARCHAR2(25),M_NAME VARCHAR2(25),C_NAME VARCHAR2(25));

create table home_details (F_NAME VARCHAR2(25),M_NAME VARCHAR2(25),C_NAME VARCHAR2(25),V_USERNAME varchar2(25));

Create Triggers:

CREATE OR REPLACE TRIGGER HOME_BEFORE_DELETE

BEFORE INSERT

ON HOME

FOR EACH ROW

DECLARE

V_USERNAME VARCHAR2(25);

BEGIN

SELECT USER INTO V_USERNAME FROM DUAL;

INSERT INTO HOME_DETAILS

(F_NAME, M_NAME, C_NAME,V_USERNAME  )

values

(:new.F_NAME,

:new.M_NAME,

:new.C_NAME ,V_USERNAME);

END;

Test:

insert into home values('a','b','c');
commit;

select * from home_details

Output:

a b c user1

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 14 2015
Added on Sep 16 2015
4 comments
774 views