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 8902485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:37:31+00:00 2026-06-15T01:37:31+00:00

Facing the following error: [Error] PLS-00049 (12: 11): PLS-00049: bad bind variable ‘NEW.OPTION_D’ I

  • 0

Facing the following error:

[Error] PLS-00049 (12: 11): PLS-00049: bad bind variable 'NEW.OPTION_D'

I am trying to execute the following:

create or replace trigger check_option_for_stage
before insert on lot_option
for each row
when (new.stage_id > 0 and new.option_id > 0)
declare 
not_existing_option exception;
num_count number;
begin
    select count(*) into num_count 
    from option_cost os
    where :new.option_id = os.option_id and :new.stage_id = os.stage_id;
    if num_count = 1 then
        DBMS_OUTPUT.PUT_LINE('The option can be applied to the lot at the current stage');
    ELSE
        raise not_existing_option;    
    end if;
exception
    when not_existing_option then
        DBMS_OUTPUT.PUT_LINE('The option is not available on this stage, therefore rejected');
    when others then
        DBMS_OUTPUT.PUT_LINE('Oops!, something went wrong, it needs your attention!');
end;
/

Why am I facing this? Why is it a bad bind variable? I know that I should be able to access the new values by typing :new.whateverthecolumnname

I am using Oracle 11g.

The definition of the table I am playing around

SQL> desc option_cost
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 COST                                      NOT NULL NUMBER
 OPTION_ID                                 NOT NULL NUMBER(38)
 STAGE_ID                                  NOT NULL NUMBER(38)

SQL> desc lot_option;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 LOT_ID                                    NOT NULL NUMBER(38)
 OPTION_ID                                 NOT NULL NUMBER(38)
 COST                                      NOT NULL NUMBER
 DATE_CREATED                                       DATE
 STAGE_ID                                  NOT NULL NUMBER(38)
  • 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-06-15T01:37:32+00:00Added an answer on June 15, 2026 at 1:37 am

    Is the column option_id (with an id at the end) or just option_d (with no i)? option_id would seem to make more sense. Assuming option_id is correct, you have a typo in your SELECT statement where you are missing the i in id. You want something like

    select count(*) 
      into count 
      from option_cost oc
     where :new.option_id = oc.option_id 
       and :new.stage_id = oc.stage_id;
    

    Of course, since count is a reserved word, it is not a good idea to declare a local variable named count. It would make much more sense to name that variable, say, l_count or use some other naming convention both to identify a local variable and to avoid using a reserved word.

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

Sidebar

Related Questions

I'm trying to replace a text using sed but facing the following error: [root@server3
I'm facing the compilation error in the following code. I'm expecting that even temporary
Im a newbie to hibernate and I'm facing an error while trying to use
I'm discover android programming and I'm facing following error : textview cannot be cast
I'm facing the following error: res/drawable-hdpi/Twitter.png: Invalid file name: must contain only [a-z0-9_.] Twitter.png
in my app I am facing following two problems I am trying to show
Possible Duplicate: iPhone CodeSign failed From last two days i am facing following error
I have the following error on execute sql file or creating database by entity
I am facing a strange error when I execute a php mail script. Its
During my web application development in asp.net I am facing following error , No

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.