473,586 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

bad bind variable trigger

17 New Member
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 23487
amitpatel66
2,367 Recognized Expert Top Contributor
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 Recognized Expert Top Contributor
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 Recognized Expert Expert
What exactly you are trying to do in trigger ?

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

Syntax for old and new keywords in Triggers were :Old.<Column_na me> referes the existing value of the column in a record. :New.<Column_Na me> 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 Recognized Expert Top Contributor
Hi Gnanda ,

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

MODERATOR
Dec 18 '07 #6
nani909090
1 New Member
@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 Contributor
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
5105
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. When I run the query it does not do the arrange and order, but if I type it in how the bind sends it, it works. If I do a...
0
1621
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, sometimes, the application stop working. In the moment that application fails, the only way to get it working again is to restart WebSphere server...
1
2692
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: DECLARE get_tabs CURSOR local fast_forward FOR SELECT distinct tablename, id, shcontig1dt, shcontig2dt FROM db_ind
2
3379
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~12 to represent months, but I want to show them as Jan/.../Dec. So I thought I could write a simple function to convert it and call that function...
1
1726
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 variable 'OLD.SNO'so tell me the reason plzzzzzzzz CREATE OR REPLACE TRIGGER TRIKAL BEFORE INSERT OR UPDATE OR DELETE ON SAMPLE FOR EACH ROW
2
9729
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 does not change much from one minute to the next. Just the timestamp. While this application runs 24/7, the error occurs once or twice a day (It's an...
2
14194
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 AF_updateAlleleTmp { Connection m_alleleCon;
0
1434
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
2200
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 it works properly declare i number:=0; begin while i<3 loop
6
6267
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 execution of the stored procedure and the insert are in a FOR-LOOP. insert into ccd_t (acct_id, acct_seq_no, acct_btn) values
0
7915
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7965
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3838
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.