473,660 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query about trigger

19 New Member
i am giving whole program of trigger plz point out any error if there
this program is in file and called as trig2.sql

drop trigger trig2;
delimiter $$
create trigger trig2 after insert on tab for each row
first_block: begin
#declare cnt int default 0;
#declare off_set int default 3;
#declare continue handler for sqlstate 'HY000';
#drop trigger trig2;
insert into tab values(20,'New value');
end first_block;
$$
delimiter ;
insert into tab values(21,'valu e is 21');

but when i go to insert data in table it gives an error message

mysql> \. c:\sqldata\trig 2.sql
Query OK, 0 rows affected (0.06 sec)

Query OK, 0 rows affected (0.00 sec)

ERROR 1442 (HY000): Can't update table 'tab' in stored function/trigger because
it is already used by statement which invoked this stored function/trigger.

so what should i do to solve this problem.
plz give reply right now.....
Mar 24 '07 #1
1 1765
ronverdonk
4,258 Recognized Expert Specialist
You are double posting in this forum!!

The duplicate thread will be removed.

moderator
Mar 25 '07 #2

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

Similar topics

1
2199
by: m3ckon | last post by:
Hi there, I'm a little stuck and would like some help I need to create an update trigger which will run an update query on another table. However, What I need to do is update the other table with the changed record value from the table which has the trigger.
3
2989
by: SS | last post by:
Hi, I don't want to refresh a web page to query and display database. I want the page shows information immediately when database changes. What kind of technology or method would be able to perform this action? Sean
2
1485
by: Alex Scollay | last post by:
Let's say I have a column whose values are all 2-digit integers, e.g. 82 (though it's actually a varchar field). From now on, the column will be able to have 2-digit as well as 3-digit integers. In the application that uses these values, a value of the format x0y is considered to be the same as xy. E.g. values 82 and 802 are considered to be the same, 45 and 405 are considered to be the same, etc. Both formats still have to be...
1
9034
by: Philehof | last post by:
Hi Group. I would like to add some information to a query. I tried to create a table with the information from the query but then if i run the query again the additional data will be lost. Below I'll try to illustrate what i mean: Table A right join Table B -> Query C -> Create Table C -> Add values to Table C
1
6202
by: abhi81 | last post by:
Hello All, I have a table on which I have created a insert,Update and a Delete trigger. All these triggers write a entry to another audit table with the unique key for each table and the timestamp. Insert and Update trigger work fine when i have only one of them defined. However when I have all the 3 triggers in place and when i try to fire a insert query on the statement. It triggers both insert and update trigger at the same time and...
2
1964
by: Massimiliano Campagnoli | last post by:
I am not able to use a recursive query (BOM query) inside a trigger in DB2 V7.2 Something like this: CREATE TRIGGER my_trigger AFTER INSERT ON my_table REFERENCING NEW AS NRS FOR EACH ROW MODE DB2SQL
5
11150
by: =?ISO-8859-1?Q?Gear=F3id?= | last post by:
Hey, This may sound odd, but is there anyway to catch the current or just run query from inside a trigger? Kinda like how profiler displays the query just as you've run it, along with all the statistical data... But I'm just looking to capture the query itself and save it in a logging table. I just need to save an executing query in certain circumstances (if detected an attempted sql injection attack) for logging purposes.
13
4165
by: Neil | last post by:
I'm running an update query in SQL 7 from QA, and it runs forever. Has been running for 20 minutes so far! The query is quite simple: update a single field in a table, based on a join with another table. There are a total of 1200 rows that are affected (out of a total of 60,000 in the table). Should not take 20 minutes! Also, retrieving the 1200 rows using the same criteria is instantaneous. Anyone have any idea what's going on? Here's...
1
15950
by: Rudolf Bargholz | last post by:
Hi, We have created triggers to log modifications to tables in our application. The triggers work fine, just on one of the tables in our database the triggers fail with the error message <SQL0437W Performance of this complex query may be sub-optimal. Reason code: "1". SQLSTATE=01602>. The same trigger on other tables works fine (the triggers are autogenerated with the same structure for most of the tables used in our application). I...
0
8851
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.