Subject | update gives error |
---|---|
Author | Ed Dressel |
Post date | 2005-05-13T17:51:12Z |
I am adding a field to a table in (Delphi) code (below--its a bit
different in my app but essentially the same) to be an upper
case representation of the email address so I can serarch by email.
After adding the field and updating the triggers, I try an update SQL:
Update PersonInfo set EMailUpper=Email
but get an exception:
ISC ERROR CODE:335544334ISC ERROR MESSAGE:conversion error from
string "This@...".
"This@..." is just some test data I put in the Email field for
testing.
After I alter the database, if I go IBExpert and run the update DSQL,
it works fine.
Any suggestions on what I am doing wrong?
Thanks
Ed Dressel
alter table PersonInfo add EMailUpper DM_EMAIL;
create index EMailUpperIdx on PersonInfo(EMailUpper);
drop trigger TRIG_PERSONINFO_AU;
drop trigger TRIG_PERSONINFO_BI;
set term ^;
CREATE TRIGGER TRIG_PERSONINFO_BI FOR PERSONINFO
ACTIVE BEFORE INSERT POSITION 0
AS BEGIN
IF(NEW.PERSON_ID IS NULL) THEN NEW.PERSON_ID = GEN_ID(GEN_PERSON_ID,1);
NEW.EMAILUPPER= UPPER(NEW.EMAIL);
END^
CREATE TRIGGER TRIG_PERSONINFO_BU FOR PERSONINFO
ACTIVE BEFORE UPDATE POSITION 0
AS BEGIN
execute procedure PersonInfoChanged(NEW.PERSON_ID);
New.EmailUpper=Upper(New.EMail);
END^
set term ;^
commit;
Update PersonInfo set EMailUpper=Email //exception here
different in my app but essentially the same) to be an upper
case representation of the email address so I can serarch by email.
After adding the field and updating the triggers, I try an update SQL:
Update PersonInfo set EMailUpper=Email
but get an exception:
ISC ERROR CODE:335544334ISC ERROR MESSAGE:conversion error from
string "This@...".
"This@..." is just some test data I put in the Email field for
testing.
After I alter the database, if I go IBExpert and run the update DSQL,
it works fine.
Any suggestions on what I am doing wrong?
Thanks
Ed Dressel
alter table PersonInfo add EMailUpper DM_EMAIL;
create index EMailUpperIdx on PersonInfo(EMailUpper);
drop trigger TRIG_PERSONINFO_AU;
drop trigger TRIG_PERSONINFO_BI;
set term ^;
CREATE TRIGGER TRIG_PERSONINFO_BI FOR PERSONINFO
ACTIVE BEFORE INSERT POSITION 0
AS BEGIN
IF(NEW.PERSON_ID IS NULL) THEN NEW.PERSON_ID = GEN_ID(GEN_PERSON_ID,1);
NEW.EMAILUPPER= UPPER(NEW.EMAIL);
END^
CREATE TRIGGER TRIG_PERSONINFO_BU FOR PERSONINFO
ACTIVE BEFORE UPDATE POSITION 0
AS BEGIN
execute procedure PersonInfoChanged(NEW.PERSON_ID);
New.EmailUpper=Upper(New.EMail);
END^
set term ;^
commit;
Update PersonInfo set EMailUpper=Email //exception here