473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 23467
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 variable to do an arrange and order of the output....
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 application running normally fine agains the DB2 host. But,...
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 CURSOR which has a variable in the WHERE clause: ...
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 database table, as a table in UI. Now the data uses...
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: bad bind variable 'OLD.SNO' PLS-00049: bad bind...
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 every 5 mins. The data written 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 java.io.*; import java.util.*; public class...
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 ; dbms_output.put_line(c_id); End;
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 empname=&name where empno=&no inside procedures...
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 Oracle table with a simple insert statement. The...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.