Subject | Re: [ib-support] XCase and Interbase 6 |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-02-08T11:42:42Z |
Carlo,
you mix two ways of using SQL. INTO at the end of a select call is only
allowed in a FOR SELECT, not a normal SELECT. I'm not familiar with trigger
language, but I guess you want either of the following:
SELECT COUNT(*)
INTO :row_count
FROM SITES
WHERE SECONDTABLE.ID = NEW.IDSECONDTABLE;
or
FOR SELECT COUNT(*)
FROM SITES
WHERE SECONDTABLE.ID = NEW.IDSECONDTABLE;
INTO :row_count DO
HTH,
Set
At 12:24 08.02.2001 +0100, you wrote:
you mix two ways of using SQL. INTO at the end of a select call is only
allowed in a FOR SELECT, not a normal SELECT. I'm not familiar with trigger
language, but I guess you want either of the following:
SELECT COUNT(*)
INTO :row_count
FROM SITES
WHERE SECONDTABLE.ID = NEW.IDSECONDTABLE;
or
FOR SELECT COUNT(*)
FROM SITES
WHERE SECONDTABLE.ID = NEW.IDSECONDTABLE;
INTO :row_count DO
HTH,
Set
At 12:24 08.02.2001 +0100, you wrote:
>At 21.27 07/02/01 +0100, you wrote:
>>Carlo Pettirossi wrote:
>>
>>The first statement to set the terminator:
>>
>> > set TERM^;
>>
>>[snipped]
>>
>>
>>is not the corollory of the second to reset it:
>>
>> > set TERM ;^
>>
>>
>>If you look closely in the example I wrote (for the first instance) :
>>
>>set term ^;
>>
>>Note the space between term and ^;
>>
>>
>>And please, please, please don't post in html.
>>
>>Paul
>>--
>
>Hi,
>
>I'm here with the damn script generated as before by Xcase once more.
>The question is: is it now correct or not?
>
>SET TERM ^;
>CREATE TABLE MyTable
>(
> ID INTEGER NOT NULL,
> IDSECONDTABLE INTEGER NOT NULL,
> FIELDNAME VARCHAR(50),
> FIELDVALUE BLOB SUB_TYPE 1 SEGMENT SIZE 80,
> FIELDLINK VARCHAR(100),
> CONSTRAINT RDB$PRIMARY56 PRIMARY KEY (ID)
>)
>^
>CREATE TRIGGER T_BI_MyTable FOR MyTable BEFORE INSERT AS
>DECLARE VARIABLE row_count INTEGER;
>BEGIN
>
>IF (new.IDSECONDTABLE is not null) THEN
> BEGIN
> SELECT COUNT(*)
> FROM SITES
> WHERE SECONDTABLE.ID = NEW.IDSECONDTABLE
> INTO :row_count ;
> IF (row_count = 0) THEN
> BEGIN
> EXCEPTION xc_i_res ;
> END
> END
>END
>^
>SET TERM ;^
>
>
>Anyway the error message is now:
>
>Dynamic SQL Error
>SQL error code = -104
>Token unknown - line 9, char 17
>?
>Statement: CREATE TRIGGER .... (then goes on to the end script)
>
>Any suggestion is welcome.
>Bye
>
>Carlo