Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6018875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:20:16+00:00 2026-05-23T03:20:16+00:00

I’m working in phpMyAdmin 3.3.9 with mySQL 5.5.8. I have a database with myISAM

  • 0

I’m working in phpMyAdmin 3.3.9 with mySQL 5.5.8. I have a database with myISAM tables so I had to write a trigger to check referential integrity between two table fields. I have a table project_key with the primary key listed as the process ID field. The second table is hvi and it also contains the process ID field. The process IDs in the hvi table must also be in the project_key table. So I wrote a trigger to display an error if this is not the case, which looks like this:

create trigger t1
before insert   
on hvi
for each row
begin
declare dummy int;
. . .
if new.`process id` not in(select `process id` from `project_key`) then 
select `Process ID not in project_key`
into dummy
from hvi
where `KEY`= new.`KEY`;
end if;
end;

If the process ID is not null this works just fine. When it catches a process ID that is trying to be imported into hvi that isn’t already in the project_key table is displays the error “Unknown column ‘Process ID not in project_key’ in ‘field list'” like it’s coded to do.

The problem comes in when I do not have a process ID for a row of data (which is a common occurrence). My record of data will have a blank space, so I want the trigger to convert that blank space to a null value and then accept this null value. I tried to code it like this, but it didn’t work:

create trigger nullt1
before insert   
on hvi
for each row
begin
declare dummy int;
if new.`Process ID` = ' ' then
set new.`Process ID` = null;
end if;
. . .
if new.`process id` not in(select `process id` from `project_key`) or null then 
select `Process ID not in project_key`
into dummy
from hvi
where `KEY`= new.`KEY`;
end if;
end;

I was taking a shot in the dark with the allowing the null part, because I’ve never tried anything like that before (I’ve done the converting blank spaces to null values before and that works). This trigger in it’s entirety obviously didn’t work though becasue when I tried to import a row with the blank space it still gives me my “Unknown column ‘Process ID not in project_key’ in ‘field list'” error.

Does anyone know how I can make this work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:20:17+00:00Added an answer on May 23, 2026 at 3:20 am

    Move your if ‘ ‘ check inside id check.

    if new.`process id` not in(select `process id` from `project_key`) then 
      if new.`process id` = ' ' then
        set new.`Process ID` = null;
      else
        select `Process ID not in project_key`
        into dummy
        from hvi
        where `KEY`= new.`KEY`;
      end if;
    end if;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.