472,353 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

bad bind variable trigger

Expand|Select|Wrap|Line Numbers
  1.  
  2. CREATE OR REPLACE TRIGGER "NEO".TEMP_TR BEFORE
  3. INSERT ON TEMP FOR EACH ROW
  4. declare
  5. c_id number:=0;
  6. BEGIN
  7. select :new_ID into c_id from dual ;
  8. dbms_output.put_line(c_id);
  9.  
  10.  
  11. End;
  12.  
i am getting the error

4/8 PLS-00049: bad bind variable 'NEW_ID'

basically i want to store :new_ID value into a variable for further processing
Dec 13 '07 #1
7 23305
amitpatel66
2,367 Expert 2GB
Hi,

Please make use of CODE tags every time you post the source code in this forum

Thanks
MODERATOR
Dec 13 '07 #2
amitpatel66
2,367 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1.  
  2. CREATE OR REPLACE TRIGGER "NEO".TEMP_TR BEFORE
  3. INSERT ON TEMP FOR EACH ROW
  4. declare
  5. c_id number:=0;
  6. BEGIN
  7. select :new_ID into c_id from dual ;
  8. dbms_output.put_line(c_id);
  9.  
  10.  
  11. End;
  12.  
i am getting the error

4/8 PLS-00049: bad bind variable 'NEW_ID'

basically i want to store :new_ID value into a variable for further processing
What is the value of :new_id?

Its not allowed in trigger because trigger uses two standard bind variables :new and :old.
Why dont you store the value of :new_id in to simple variable within a trigger and do what ever you want to??
Dec 13 '07 #3
debasisdas
8,127 Expert 4TB
What exactly you are trying to do in trigger ?

What is that :new_ID ???
Dec 13 '07 #4
gnanda
2
Dear Friend,

Syntax for old and new keywords in Triggers were :Old.<Column_name> referes the existing value of the column in a record. :New.<Column_Name> referes the new value for the column in a record.

In your Triggers what is New_id? is a column in Temp table.

If New_id is a column in Temp table then use :New.New_id or only ID is a column in the Temp table then use :New.Id.

And u can directly assign the value to the variable c_id like c_id=:new.id(I am considering ID is the column name)

go though this

Expand|Select|Wrap|Line Numbers
  1.  
  2. SQL> create table temp (id varchar2(15));
  3.  
  4. Table created.
  5.  
  6. SQL> ed
  7. Wrote file afiedt.buf
  8.  
  9. line 9 truncated.
  10.   1  CREATE OR REPLACE TRIGGER TEMP_TR BEFORE
  11.   2  INSERT ON TEMP FOR EACH ROW
  12.   3  DECLARE
  13.   4    c_id varchar2(15);
  14.   5  BEGIN
  15.   6    c_id :=:new.id;
  16.   7    dbms_output.put_line('Output from the Trigger c_id : '||c_id);
  17.   8* END;
  18.   9  /
  19.  
  20. Trigger created.
  21.  
  22. SQL> set serveroutput on;
  23. SQL> insert into temp values('Gnk');
  24. Output from the Trigger c_id : Gnk
  25.  
  26. 1 row created.
  27.  
  28. SQL> 
  29.  
  30.  


Regards
GNK
Dec 18 '07 #5
amitpatel66
2,367 Expert 2GB
Hi Gnanda ,

please make use of [code] tags when ever you post any code in this forum.

MODERATOR
Dec 18 '07 #6
@amitpatel66
Hi the main problem with new.id you just change the id value
it will be work for example my table variable is name then give new.name it will be workkkk...
Aug 14 '13 #7
Exequiel
288 256MB
I didn't mean to reply to this post, I just accidentally send the message here a while,, sorry. . . since i can't delete this comment i just type some suggestions. . sorry again
Aug 15 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Hermes | last post by:
Hi all, I'm using bind variables in sql in some asp pages, but something strange is happening with a few of the pages. I'm trying to add a bind...
0
by: ClimberBear | last post by:
Hi, I've got a very strange problem with a Websphere 5.1 cluster attached to DB2 database in Mainframe z/OS. I have a J2EE deployed...
1
by: traceable1 | last post by:
SQL Server 2000 SP4 with AWE hotfix. Windows 2003 SP1. I have a stored procedure which is not working the way I think it should be. I have a...
2
by: duancg | last post by:
Hi, I wonder if someone could help since I wasn't able to find the answer through search. I have a simple .aspx page that shows data from a...
1
kaleeswaran
by: kaleeswaran | last post by:
this is my trigger function but when i tried to run the pgm the error shows like this: PLS-00049: bad bind variable 'NEW.SNO' PLS-00049:...
2
by: jeanbdenis | last post by:
Hi Folks, I have been struggling with this issues for the last couple of days. I have a java application which does an update to the database...
2
by: lunas | last post by:
hi i am trying to update a table selecting a value from another table and ve written the following codes for it.. import java.sql.*; import...
0
by: umesh049 | last post by:
CREATE OR REPLACE TRIGGER "NEO".TEMP_TR BEFORE INSERT ON TEMP FOR EACH ROW declare c_id number:=0; BEGIN select :new_ID into c_id from dual...
5
by: femina | last post by:
can i use the bind variable inside a procedure and the query like update emp set empname=:name where empno=:no; but i work like update emp set...
6
by: pretzla | last post by:
I have a PL/SQL script where I load data from a stored procedure into bind variables. Then, I insert that data from the bind variables into an...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.