473,320 Members | 1,732 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,320 software developers and data experts.

Problems with Triggers

Hello,

is there a simple operator to determine whether the OLD.value and
NEW.value are different. The <> operator is not working on NULL's.

I need something like this:
NEW.val <> Old.val OR
NEW.val IS NULL AND OLD.val IS NOT NULL OR
NEW.val IS NOT NULL AND OLD.val IS NULL

Thanks in advance

Sebastian

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #1
3 1399
El Jue 15 Abr 2004 08:55, Sebastian Böck escribió:
Hello,

is there a simple operator to determine whether the OLD.value and
NEW.value are different. The <> operator is not working on NULL's.

I need something like this:
NEW.val <> Old.val OR
NEW.val IS NULL AND OLD.val IS NOT NULL OR
NEW.val IS NOT NULL AND OLD.val IS NULL


(NEW.val <> Old.val) OR
(NEW.val IS NULL AND OLD.val IS NOT NULL) OR
(NEW.val IS NOT NULL AND OLD.val IS NULL)

You forgot the parenthesis, to group the conditions accordingly

--
11:56:01 up 37 days, 16:23, 2 users, load average: 1.86, 0.99, 0.72
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #2
On Thu, 15 Apr 2004, [ISO-8859-1] Sebastian Böck wrote:
is there a simple operator to determine whether the OLD.value and
NEW.value are different. The <> operator is not working on NULL's.
Not as far as I know, although I think you can simplify the last part as
(NEW.val IS NULL <> OLD.val IS NULL)
I need something like this:
NEW.val <> Old.val OR
NEW.val IS NULL AND OLD.val IS NOT NULL OR
NEW.val IS NOT NULL AND OLD.val IS NULL


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3
Martin Marques wrote:
El Jue 15 Abr 2004 08:55, Sebastian Böck escribió:
Hello,

is there a simple operator to determine whether the OLD.value and
NEW.value are different. The <> operator is not working on NULL's.

I need something like this:
NEW.val <> Old.val OR
NEW.val IS NULL AND OLD.val IS NOT NULL OR
NEW.val IS NOT NULL AND OLD.val IS NULL



(NEW.val <> Old.val) OR
(NEW.val IS NULL AND OLD.val IS NOT NULL) OR
(NEW.val IS NOT NULL AND OLD.val IS NULL)

You forgot the parenthesis, to group the conditions accordingly


Yes i did in my mail, but that's not the question.
I wanted to know if there is a special operator that does exactly
this.

Sebastian
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Don Freeman | last post by:
Seems like whatever value I use for the first int field (starting position) the substring procedure negates it and triggers a String index out of range error. I've tried all sorts of work...
0
by: Marko Damaschke | last post by:
Hello alltogether, i'm working on a database-plattform which should work with fail-over-technics. Therefor 2 identic machines with internal RAID are available, which work in...
4
by: Mark Flippin | last post by:
I'm just starting to use triggers in my databases and find the support in Enterpise Manager lacking. Using Enterprise Manager and Query Analyzer you can maintain the triggers, but it's...
1
by: tim.pascoe | last post by:
I'm trying to generate scrips for a database, and everything so far has worked fine, except for the triggers. When I try and script existing triggers, all I get is a blank file - no SQL script. I...
6
by: George McLean | last post by:
Hello, I am trying to isolate some performance issues. The database is DB2 v8.1 running on a Win2000 server with 4 processors and 1gb of RAM. The application is a GIS application that uses...
3
by: Joachim Klassen | last post by:
Hi all, first apologies if this question looks the same as another one I recently posted - its a different thing but for the same szenario:-). We are having performance problems when...
20
by: Alan Silver | last post by:
Hello, I have read about the problems that IE has when using a doctype of HTML 4.01 Transitional. I was advised to use Strict wherever possible. My question is, does the same apply to XHTML...
0
debasisdas
by: debasisdas | last post by:
trigger sample code Ex#10 ======================= INSTEAD OF TRIGGER ---------------------------------------- create or replace trigger mytrig instead of delete or insert or update on eview...
0
debasisdas
by: debasisdas | last post by:
This thread contains some useful tips/sample codes regarding TRIGGERS in oracle, that the forum members may find useful. TRIGGERS: =============== Database trigger is a PL/SQL block that is...
4
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.