Search Results

Search found 2670 results on 107 pages for 'trigger'.

Page 1/107 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • consistency of Trigger Procedure (before row trigger) Postgresql

    - by elgcom
    Using Postgresql. I try to use TRIGGER procedure to make some consistency check on INSERT. The question is ...... whether "BEFORE INSERT FOR EACH ROW" can make sure each row to insert "checked" and "inserted" one after another? do I need extra lock on table to survive from concurrent insert? check for new row1 - insert row1 - check for new row2 - insert row2 -- -- -- unexpired product name is unique. CREATE TABLE product ( "name" VARCHAR(100) NOT NULL, "expired" BOOLEAN NOT NULL ); CREATE OR REPLACE FUNCTION check_consistency() RETURNS TRIGGER AS $$ BEGIN IF EXISTS (SELECT * FROM product WHERE name=NEW.name AND expired='false') THEN RAISE EXCEPTION 'duplicated!!!'; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TRIGGER trigger_check_consistency BEFORE INSERT ON product FOR EACH ROW EXECUTE PROCEDURE check_consistency(); -- INSERT INTO product VALUES("prod1", true); INSERT INTO product VALUES("prod1", false); INSERT INTO product VALUES("prod1", false); // exception! this is OK name | expired ============== p1 | true p1 | true p1 | false This is not OK name | expired ============== p1 | true p1 | false p1 | false or maybe I should ask, how can I use Trigger to implement "Primary" or "Unique" constraint-like SQL.

    Read the article

  • The penultimate audit trigger framework

    - by Piotr Rodak
    So, it’s time to see what I came up with after some time of playing with COLUMNS_UPDATED() and bitmasks. The first part of this miniseries describes the mechanics of the encoding which columns are updated within DML operation. The task I was faced with was to prepare an audit framework that will be fairly easy to use. The audited tables were to be the ones directly modified by user applications, not the ones heavily used by batch or ETL processes. The framework consists of several tables and procedures...(read more)

    Read the article

  • Behaviour of insertion trigger when defining autoincrement in Oracle

    - by Genba
    I have been looking for a way to define an autoincrement data type in Oracle and have found these questions on Stack Overflow: Autoincrement in Oracle Autoincrement Primary key in Oracle database The way to use autoincrement types consists in defining a sequence and a trigger to make insertion transparent, where the insertion trigger looks so: create trigger mytable_trg before insert on mytable for each row when (new.id is null) begin select myseq.nextval into :new.id from dual; end; I have some doubts about the behaviour of this trigger: What does this trigger do when the supplied value of "id" is different from NULL? What does the colon before "new" mean? I want the trigger to insert the new row with the next value of the sequence as ID whatever the supplied value of "new.id" is. I imagine that the WHEN statement makes the trigger to only insert the new row if the supplied ID is NULL (and it will not insert, or will fail, otherwise). Could I just remove the WHEN statement in order for the trigger to always insert using the next value of the sequence?

    Read the article

  • calling perl script from mysql trigger

    - by Bahareh
    I want to call a perl script inside a mysql after insert trigger. but my trigger does not work.I find this solution from google. here is my code: DROP TRIGGER IF EXISTS 'tr1'// CREATE TRIGGER 'tr1' AFTER INSERT ON 'username' FOR EACH ROW begin SET @result=sys_exec(CONCAT('/usr/bin/perl /etc/p1.pl')); end // and my p1.pl code: #!/usr/bin/perl open(MYFILE,'>>/etc/data.txt'); print MYFILE "BOB\n"; close MYFILE; thanks.

    Read the article

  • Wpf ListBox Trigger not working for IsFocused Property.

    - by viky
    I want to style my ListBox and displaying some Border around it, i want to hide this Border when ListBox gets focus, <Trigger Property="IsFocused" Value="True"> <Setter Property="Visibility" TargetName="border" Value="Collapsed"/> </Trigger> Same thing i m using in TextBox also and it is working properly, why this Trigger not working for ListBox? Edit: i am having this Style for my ListBox <ControlTemplate TargetType="{x:Type local:ListBox}"> <Border SnapsToDevicePixels="true" x:Name="Bd" CornerRadius="5" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1"> <Grid> <local:ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}"> <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> </local:ScrollViewer> <Border CornerRadius="5" Background="Red" x:Name="border"> <TextBlock VerticalAlignment="Center" FontWeight="Bold" Foreground="White" Text="{TemplateBinding Message}" FontFamily="Courier New" /> </Border> </Grid> </Border> </DockPanel> <ControlTemplate.Triggers> <Trigger Property="IsFocused" Value="True"> <Setter Property="Visibility" TargetName="border" Value="Collapsed"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/> </Trigger> <Trigger Property="IsGrouping" Value="true"> <Setter Property="ScrollViewer.CanContentScroll" Value="false"/> </Trigger> </ControlTemplate.Triggers>

    Read the article

  • After Trigger execute before constraint check in oracle

    - by satakare
    Hi, I have After Insert/Update trigger on Table T1 which get the referential data for Col1 from T2 and does some work and insert it into another table. The col1 is FK to Table T2. When user insert the incorrect or non existing value into the Col1 and if trigger is disabled I am getting constraint error that is fine. But when trigger is enabled and user insert the wrong value in Col1 trigger is getting fired and shows the 'no data found' error message. Actually I am expecting the table to throw constraint error, but trigger is throwing it. Please let me know your comments about this trigger behaviour.

    Read the article

  • Using OUTPUT/INTO within instead of insert trigger invalidates 'inserted' table

    - by Dan
    I have a problem using a table with an instead of insert trigger. The table I created contains an identity column. I need to use an instead of insert trigger on this table. I also need to see the value of the newly inserted identity from within my trigger which requires the use of OUTPUT/INTO within the trigger. The problem is then that clients that perform INSERTs cannot see the inserted values. For example, I create a simple table: CREATE TABLE [MyTable]( [MyID] [int] IDENTITY(1,1) NOT NULL, [MyBit] [bit] NOT NULL, CONSTRAINT [PK_MyTable_MyID] PRIMARY KEY NONCLUSTERED ( [MyID] ASC )) Next I create a simple instead of trigger: create trigger [trMyTableInsert] on [MyTable] instead of insert as BEGIN DECLARE @InsertedRows table( MyID int, MyBit bit); INSERT INTO [MyTable] ([MyBit]) OUTPUT inserted.MyID, inserted.MyBit INTO @InsertedRows SELECT inserted.MyBit FROM inserted; -- LOGIC NOT SHOWN HERE THAT USES @InsertedRows END; Lastly, I attempt to perform an insert and retrieve the inserted values: DECLARE @tbl TABLE (myID INT) insert into MyTable (MyBit) OUTPUT inserted.MyID INTO @tbl VALUES (1) SELECT * from @tbl The issue is all I ever get back is zero. I can see the row was correctly inserted into the table. I also know that if I remove the OUTPUT/INTO from within the trigger this problem goes away. Any thoughts as to what I'm doing wrong? Or is how I want to do things not feasible? Thanks.

    Read the article

  • Determine caller within stored proc or trigger

    - by Mike Clark
    I am working with an insert trigger within a Sybase database. I know I can access the @@nestlevel to determine whether I am being called directly or as a result of another trigger or procedure. Is there any way to determine, when the nesting level is deeper than 1, who performed the action causing the trigger to fire? For example, was the table inserted to directly, was it inserted into by another trigger and if so, which one.

    Read the article

  • Updating files with a Perforce trigger before submit [migrated]

    - by phantom-99w
    I understand that this question has, in essence, already been asked, but that question did not have an unequivocal answer, so please bear with me. Background: In my company, we use Perforce submission numbers as part of our versioning. Regardless of whether this is a correct method or not, that is how things are. Currently, many developers do separate submissions for code and documentation: first the code and then the documentation to update the client-facing docs with what the new version numbers should be. I would like to streamline this process. My thoughts are as follows: create a Perforce trigger (which runs on the server side) which scans the submitted documentation files (such as .txt) for a unique term (such as #####PERFORCE##CHANGELIST##NUMBER###ROFL###LOL###WHATEVER#####) and then replaces it with the value of what the change list would be when submitted. I already know how to determine this value. What I cannot figure out, is how or where to update the files. I have already determined that using the change-content trigger (whether possible or not), which "fire[s] after changelist creation and file transfer, but prior to committing the submit to the database", is the way to go. At this point the files need to exist somewhere on the server. How do I determine the (temporary?) location of these files from within, say, a Python script so that I can update or sed to replace the placeholder value with the intended value? The online documentation for Perforce which I have found so far have not been very explicit on whether this is possible or how the mechanics of a submission at this stage would work.

    Read the article

  • How to trigger a SQL Agent Job from a client PC

    - by Preet Sangha
    I have SQL Agent job that is automated that a non SQL Admin user may need to occasionaly run. I know I can trigger a SQL Agent Job via sp_execute_job. Can anyone tell me where to find what I need installed on a (Non SQL Server box) client PC in order to run one of - SQLCmd, OSQL or ISQL - commands please, so I can execute the above SQL? Or is there are simpler way perhaps with out calling TSQL or without installing any SQL client tools.

    Read the article

  • Trigger doesn't work

    - by Pasha
    Hello everyone, I have an user control, It is editable text block. The content of the control is: <DataTemplate x:Key="DisplayModeTemplate"> <TextBlock Text="{Binding ElementName=mainControl, Path=FormattedText}" Margin="5,3,5,3" /> </DataTemplate> <Style TargetType="{x:Type Controls:EditableTextBlock}"> <Setter Property="ContentTemplate" Value="{StaticResource EditModeTemplate}"/> <Style.Triggers> <Trigger Property="IsInEditMode" Value="True"> <Setter Property="ContentTemplate" Value="{StaticResource EditModeTemplate}" /> </Trigger> <Trigger Property="IsInEditMode" Value="False"> <Setter Property="ContentTemplate" Value="{StaticResource DisplayModeTemplate}" /> </Trigger> </Style.Triggers> </Style> </UserControl.Resources> Also i have another window with tree view: When treeView1_KeyDown fires I set IsInEditMode to true, but it seems that trigger doesn't work, because content template don't change. Anyone, please explain me why?

    Read the article

  • WPF Trigger / Style overrides another

    - by ozczecho
    I have a listview defined as such <ListView Width="auto" SelectionMode="Single" ItemContainerStyle="{StaticResource baseListViewStyle}" .... Then in "baseListViewStyle" I have defined some base styles to apply to my list views, including a Style trigger: <Style x:Key="baseListViewStyle" TargetType="ListViewItem"> <Setter Property="Height" Value="20" /> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Foreground" Value="Red" /> </Trigger> </Style.Triggers> </Style> The trigger here highlights the row when mouse is over it. Nice. I also have a Data Trigger on the listviewitem: <Style.Triggers> <DataTrigger Binding="{Binding IsTestTrue}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource SomeFunkyAnimation}" /> </DataTrigger.EnterActions> </DataTrigger> If test is true then a nice little fade animation is played out. This all works except when I move my mouse over the row where "test is true" the animation stops and the mouse over style is displayed. Any ideas how I can override that style in my DataTrigger? TIA

    Read the article

  • Logging into table in MS SQL trigger

    - by Martin
    I am coding MS SQL 2005 trigger. I want to make some logging during trigger execution, using INSERT statement into my log table. When there occurs error during execution, I want to raise error and cancel action that cause trigger execution, but not to lose log records. What is the best way to achieve this? Now my trigger logs everything except situation when there is error - because of ROLLBACK. RAISERROR statement is needed in order to inform calling program about error. Now, my error handling code looks like: if (@err = 1) begin INSERT INTO dbo.log(date, entry) SELECT getdate(), 'ERROR: ' + out from #output RAISERROR (@msg, 16, 1) rollback transaction return end

    Read the article

  • WPF Style: how to change GradientStop Color in Trigger

    - by Nike
    I have a Button Style: <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Path x:Name="path1" ... Data="...some data..."> <Path.Fill> <LinearGradientBrush EndPoint="0.5,-0.3" StartPoint="0.5,0.8"> <GradientStop x:Name="gs1" Color="Green" Offset="0.44"/> <GradientStop Color="Black" Offset="0.727"/> </LinearGradientBrush> </Path.Fill> </Path> <ContentPresenter ...properties... /> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="???" Property="Color" Value="Green"></Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> I want to change the Color of GradientStop with x:Name="gs1" when mouse is over button, so I use Trigger IsMouseOver. How can i get an access to Color Property in Trigger? I tried TargetName="path1.gs1" but it doesn't work. Any idea?

    Read the article

  • question about MySQL transaction and trigger

    - by WilliamLou
    I quickly browsed MySQL manual but didn't find the exact information about my question. Here is my question: if I have a InnoDB table A with two triggers triggered by 'AFTER INSERT ON A' and 'AFTER UPDATE ON A'. More specifically, For example: one trigger is defined as: CREATE TRIGGER test_trigger AFTER INSERT ON A FOR EACH ROW BEGIN INSERT INTO B SELECT * FROM A WHERE A.col1 = NEW.col1 END; You can ignore the query between BEGIN AND END, basically I mean this trigger will insert several rows into table B which is also a InnoDB table. Now, if I started a transaction and then insert many rows, say: 10K rows, into table A. If there is no trigger associated with table A, all these inserts are atomic, that's for sure. Now, if table A is associated with several insert/update triggers which insert/update many rows to table B and/or table C etc.. will all these inserts and/or updates are still all atomic? I think it's still atomic, but it's kind of difficult to test and I can't find any explanations in the Manual. Anyone can confirm this? Thanks a lot!

    Read the article

  • Trigger Happy

    - by Tim Dexter
    Its been a while, I know, we’ll say no more OK? I’ll just write …In the latest BIP 11.1.1.6 release and if I’m really honest; the release before this (we'll call it dot 5 for brevity.) The boys and gals in the engine room have been real busy enhancing BIP with some new functionality. Those of you that use the scheduling engine in OBIEE may already know and use the ‘conditional scheduling’ feature. This allows you to be more intelligent about what reports get run and sent to folks on a scheduled basis. You create a ‘trigger’ analysis (answer) that is executed at schedule time prior to the main report. When the schedule rolls around, the trigger is run, if it returns rows, then the main report is run and delivered. If there are no rows returned, then the main report is not run. Useful right? Your users are not bombarded with 20 reports in their inbox every week that they need to wade throu. They get a handful that they know they need to look at. If you ensure you use conditional formatting in the report then they can find the anomalous data in the reports very quickly and move on to the rest of their day more quickly. You could even think of OBIEE as a virtual team member, scouring the data on your behalf 24/7 and letting you know when its found an issue.BI Publisher, wanting the team t-shirt and the khaki pants, has followed suit. You can now set up ‘triggers’ for it to execute before it runs the main report. Just like its big brother, if the scheduled report trigger returns rows of data; it then executes the main report. Otherwise, the report is skipped until the next schedule time rolls around. Sound familiar?BIP differs a little, in that you only need to construct a query to act as the trigger rather than a complete report. Let assume we have a monthly wage by department report on a schedule. We only want to send the report to managers if their departmental wages reach and/or exceed a certain amount. The toughest part about this is coming up with the SQL to test the business rule you want to implement. For my example, its not that tough: select d.department_name, sum(e.salary) as wage_total from employees e, departments d where d.department_id = e.department_id group by d.department_name having sum(e.salary) > 230000 We're looking for departments where the wage cost is greater than 230,000 Dexter Dollars! With a bit of messing I found out you can parametrize the query. Users can then set a value at schedule time if they need to. To create the trigger is straightforward enough. You can create multiple triggers for users to select at schedule time. Notice I also used a parameter in the query, :wamount. Note the matching parameter in the tree on the left. You also dont need to return multiple columns, one is fine, the key is if there are rows returned. You can build the rest of your report as usual. At scheduling time the Schedule tab has a bit more on it. If your users want to set the trigger, they check the Use Trigger box. The page will then pop fields to pick the appropriate trigger they want to use, even a trigger on another data model if needed. Note it will also ask for the parameter value associated with the trigger. At this point you should note that the data model does not make a distinction between trigger and data model (extract) parameters. So users will see the parameters on the General and Schedule tabs. If per chance you do need to just have a trigger parameters. You can just hide them from the report using the Parameters popup in the report designer, just un-check the 'Show' box I have tested the opposite case where you do not want main report parameters seen in the trigger section. BIP handles that for you! Once the report hits its allotted schedule time, the trigger is executed. Based on the results the report will either run or be 'skipped.' Now, you have a smarter scheduler that will only deliver reports when folks need to see them and take action on the contents. More official info here for developers and here for users.

    Read the article

  • WPF TextBox trigger to clear Text

    - by PaN1C_Showt1Me
    Hi ! I have many TextBox controls and I'm trying to write a style that clears the Text property when the Control is disabled. I don't want to have Event Handlers in code behind. I wrote this: <Style TargetType="{x:Type TextBox}"> <Style.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Text" Value="{x:Null}" /> </Trigger> </Style.Triggers> </Style> The problem is that if the TextBox is defined like: <TextBox Text={Binding Whatever} /> then the trigger does not work (probably because it's bound) How to overcome this problem?

    Read the article

  • XAML trigger as StaticResource

    - by adrianm
    Why can't I create a trigger and use it as a static resource in XAML? <Window.Resources> <Trigger x:Key="ValidationTrigger" x:Shared="False" Property="Validation.HasError" Value="true"> <Setter Property="FrameworkElement.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)/ErrorContent}"/> </Trigger> <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}"> <Style.Triggers> <StaticResource ResourceKey="ValidationTrigger"/> </Style.Triggers> </Style> </Window.Resources> I get an errormessage at runtime "Value cannot be null. Parameter name: triggerBase Error at object 'System.Windows.Markup.StaticResourceHolder' in markup file"

    Read the article

  • MySQL Trigger creation

    - by Bruce Garlock
    I have an application where I need to INSERT an auto_increment value from a PK in another table. I know how to do this in PHP, but I need to have this done at the DB level, since I cannot change the program logic. I am new to triggers, so I'm sure this will be an easy answer for someone. Here is what I have so far: DELIMITER // CREATE TRIGGER new_project AFTER INSERT ON m_quality_header FOR EACH ROW BEGIN INSERT INTO m_quality_detail (d_matl_qa_ID) VALUES (NEW.h_matl_qa_ID); END// DELIMITER ; I just want the value of the auto_increment value from h_matl_qa_ID to be inserted as a new record into d_matl_qa_ID. The error I get is: "This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' But, I don't want to update the table that has the trigger, so why is my current code considered a 'multiple' trigger? This is on MySQL 5.0.45-7.el5 running on a CentOS 5 server (64-bit Intel) If I have to, I can modify the PHP code, but that needs to be the last resort.

    Read the article

  • mutating, trigger/function may not see it- error during execution of trigger

    - by mahesh soni
    CREATE OR REPLACE TRIGGER UPDATE_TEST_280510 AFTER insert on TEST_TRNCOMPVISIT declare V_TRNCOMPNO NUMBER(10); CURSOR C1 IS SELECT B.COMPNO FROM TEST_TRNCOMPVISIT A, TEST_TRNCOMPMST B, TEST_MEMMAST C WHERE A.COMPNO=B.COMPNO AND B.TRNMEMID=C.MEMID AND C.MEMOS=1000; begin open c1; fetch c1 into V_TRNCOMPNO; UPDATE TEST_TRNCOMPMST SET COMPSTATUS='P', remark='comp is pending due to O/S1000' WHERE COMPNO=V_TRNCOMPNO AND COMPSTATUS='C'; CLOSE C1; end; I have made this trigger and while insert the row in table- TEST_TRNCOMPVISIT it gives following error- The following error has occurred: ORA-04091: table TEST.TEST_TRNCOMPVISIT is mutating, trigger/function may not see it ORA-06512: at "TEST.UPDATE_TEST_280510", line 4 ORA-06512: at "TEST.UPDATE_TEST_280510", line 10 ORA-04088: error during execution of trigger 'TEST.UPDATE_TEST_280510' Kindly suggest over this. MaheshA.....

    Read the article

  • jquery event handler- trigger function upon specific key and action

    - by Gal
    Background story: when a user selects a portion of text in a text field with her mouse (mark it up manually), and subsequently hits "alt" key, a certain function would trigger. My questions are: How can I trigger a function when a user hits a key (in her keyboard)? How can I preserve a portion of text selected, and use it as a parameter for that function? I've tried looking up online but haven't found any good answers, but i'd greatly appreciate links as well.

    Read the article

  • MySQL Trigger with dynamic table name

    - by Thomas
    I've look around a bit and can't quite find an answer to my problem: I want a trigger to execute after an insert on a table and to take that data that is being inserted and do two things Create a new table from the client id and partner id Insert the 'data' that just was inserted into the new table I am fairly new to the Stored procedures and triggers so I came up with this but am having difficulty debugging it: delimiter $$ CREATE TRIGGER trg_creas_insert BEFORE INSERT ON tracking.creas for each row BEGIN DECLARE @tableName varchar(40); DECLARE @createStmnt mediumtext; SET @tableName = concat('crea_','_', NEW.idClient_crea,'_',NEW.idPartenaire_crea); SET @createStmnt = concat('CREATE TABLE IF NOT EXISTS', @tableName, '( `data_crea` mediumtext NOT NULL ) ENGINE=MyISAM AUTO_INCREMENT=29483330 DEFAULT CHARSET=utf8 PACK_KEYS=0'); PREPARE stmt FROM @createStmnt; EXECUTE stmt; INSERT INTO @tableName (data_crea) values (NEW.data_crea); END$$ delimiter ; Thoughts?

    Read the article

  • Adding hover trigger from another div

    - by jakeprzespo
    I am trying to activate the native hover effect of a div from another div. I understand that I could do this all in jQuery and add the styles in there, but would rather leave the native :hover in the CSS. I'm just wondering if there is a way for this to work: $("#div1").live("mouseenter", function() { $("#div2").trigger("mouseenter"); }); I'd like to call it by doing something like this, but it isn't working. Is there really no way to trigger an event from another element's event? Thanks in advance.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >