Subject RE: [firebird-support] Query Problem
Author Svein Erling Tysvær
Huh? Did you read through your question trying to look at it as someone not familiar with your problem before posting? I have a hard time trying to guess what your question is, though I can of course guess a few possible answers depending on what you're actually after...

You want to return two rows, one with VESSEL_ID and another with SYSTEM_ID from a stored procedure:
Answer: Use SUSPEND between each statement.

You want to assign the newly generated VESSEL_ID or SYSTEM_ID to FIELD1:
Answer: NEW.FIELD1 = CASE WHEN NEW.VESSEL_ID is NULL then GEN_ID(GEN_VESSEL_ID,1);
WHEN NEW.SYSTEM_ID is NULL then GEN_ID(GEN_SYSTEM_ID,1);
END;

You want to assign the text 'VESSEL_ID' or 'SYSTEM_ID' to FIELD1
Answer: NEW.FIELD1 = CASE WHEN NEW.VESSEL_ID is NULL then 'VESSEL_ID';
WHEN NEW.SYSTEM_ID is NULL then 'SYSTEM_ID';
END;

You want to return the value assigned in a trigger to the calling program:
Answer: If you're using a sufficiently new Firebird version, you can use RETURNING VALUES or something similar in your INSERT statement (I don't use that, and neither know the exact word nor the version when it appeared, I think it might have been 2.0), if not you should insist on getting the generator value from the calling program (with IBO, I just set GeneratorLinks in my programs).

You want an insert statement to return two rows:
Answer: Sorry, I don't think this is possible.

Please make your question clearer if you want a better answer,
Set

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Jack Corpuz
Sent: 7. mai 2008 08:21
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Query Problem

Hi All,
I have a hard time creating a solution on how to get a certain value on a certain column. I am using Firebird 2.0 version.
Field1
VESSEL_ID IS NULL) THEN NEW.VESSEL_ID = GEN_ID(GEN_VESSEL_ID,1);
COMPANY_ID IS NULL) THEN NEW.VESSEL_ID = GEN_ID(GEN_VESSEL_ID,1);
On the above example, I want to get the "Vessel_ID" and "Company_ID". I can not make a SUBSTRING because it only uses fixed lengths.
I want the results to be like this: see below..
Field1
VESSEL_ID
SYSTEM_ID
Kindly help me on this. Thanks in advance!
Regards,
Jack