×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
You're getting close... The problem is you've got an extra else clause
in there. First, remote all semicolons, you don't need any here. Second,
using line numbers below, what's the point of the else clause starting
at line 10? I think you can completely kill lines 10 to 15 and you'll be
all set.
I would note that there is a (granted, very small) possibility of a
duplicate key or missing hit on the email table. If the record exists at
line 1, but is deleted before line 3 is executed, or doesn't exist at
line 1, but is inserted (by another job) before line 7 is executed. Not
likely, but figured I'd point it out.
0) P1: BEGIN
1) IF EXISTS (SELECT * FROM MYDB.EMAIL WHERE EMAIL_ID = em;)
2) THEN
3) UPDATE MYDB.EMAIL
4) SET EMAIL_DESC= 'YYY'
5) WHERE EMAIL_ID = em;
6) ELSE
7) INSERT INTO MYDB.EMAIL(EMAIL_ID, EMAIL_DESC)
8) VALUES (em, 'YYY')
9) END IF;
10) ELSE
11) UPDATE MYDB.EMAIL
12)
13) SET EMAIL_DESC = 'YYY'
14) WHERE EMAIL_ID = em;
15) END IF
16) END P1
-Walden
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.