Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6939229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:35:44+00:00 2026-05-27T12:35:44+00:00

I made a table student, in which there is an attribute evaluation. Now i

  • 0

I made a table student, in which there is an attribute evaluation.
Now i am making a trigger in which i want that if i insert a value of zero in evaluation then a trigger should fire and store some values in audit_table.
here is my code

Create table Student ( Student_Id Number(8,2), Student_Name Varchar2(50), Gender Varchar(8), Telephone_No Number(15), Location Varchar2(200), Education Varchar2(100), Company_name Varchar2(200), No_of_attempt    Number(2), Offering_Id  Number(3) , EVALUATION NUMBER(2), Primary Key (Student_Id), Constraint fk_Oid Foreign Key (Offering_Id) References Course(Offering_Id) );

And now the audit table code

CREATE TABLE AUDIT_TABLE ( STUD_NAME VARCHAR2(100), COURSE_NAME
VARCHAR2(100), INSTRUCTOR_NAME VARCHAR2(200), EVALUATION NUMBER (2)

);

Now my main question is this my trigger not working

    create trigger tr_student
after insert or update on student
for each row
declare 
s_name student.student_name%type; 
s_eval student.evaluation%type;
s_offr_id student.offering_id%type;
s_course_name student.student_name%type;
s_instr student.student_name%type;

begin
if evaluation == 0;
s_offr_id =(select offering_id from student where evaluation==0);
s_eval =0;
s_name =(select student_name from student where evaluation==0);
s_course_name =(select course_name from course where offering_id==s_offr_id);
s_instr=(select name from instructor where offering_id==s_offr_id);
insert into AUDIT_TABLE values(s_name,s_course,s_instr,s_eval);
end; 

Is there some problem with my trigger?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:35:44+00:00Added an answer on May 27, 2026 at 12:35 pm

    This is not possible:

    s_name =(select student_name from student where evaluation==0);
    

    Change it to

    select student_name into s_name from student where evaluation = 0;
    

    Note there are two problems. First, you need into to select a value into a variable. Second, the comparison operator in SQL is only a single =.

    The same goes for

    if evaluation == 0;
      ..
    end;
    

    It should be

    if :new.evaluation = 0 then
      ...
    end if;
    

    So there, the you forgot the then and end if, the comparison operator is wrong and you need :new.fieldname to get the value of the field, instead of a local variable.

    The assignment operator in PLSQL is :=, so

    s_eval =0; 
    

    should be changed to

    s_eval := 0;
    

    It seems you need to grab the schoolbook again and do some more reading. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a trigger that stores changes made in a separate table when a
is there a way to insert pics(not url,the pic)into a MYSQL table made with
I have a Student table which should have name column. But I made another
I have made a dump of my database in which one table is pretty
I once had a MySQL database table containing 25 million records, which made even
just wondering is there any way that I can return one value from my
I have made a table using GtkTable and in that table I have attached
I have a custom-made site which I want to migrate to a commercial solution
I have a JTable for which I have made a table model. But on
I am using asp(vb) In SQL Server database I made a table cars which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.