1

Topic: IF and FOR SELECT on a deleted field

execute block as
declare vN VARCHAR (250);
begin
IF (EXISTS (SELECT 1 FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME = ' T1 ' AND RDB$FIELD_NAME = ' TXT ')) THEN BEGIN
for select TXT from T1 into:vN do
----
EXECUTE STATEMENT ' ALTER TABLE T1 DROP TXT ';
end
end

Reversal error to T1.TXT at script restart.
It turns out for select  or it is fulfilled ignoring result of condition IF?
IF checked up works as well as it is expected.
FB 2.1.7

2

Re: IF and FOR SELECT on a deleted field

No, certainly. How "checked", a debugger?
"Restart" after  or without ?

3

Re: IF and FOR SELECT on a deleted field

All procedure  also is prepared simultaneously. Here to you not MS SQL, interpreting
on separate requests.

4

Re: IF and FOR SELECT on a deleted field

And, it also   a field...
Yes, so it is impossible, there will be an error on .
The decision is obvious, of course, but .

5

Re: IF and FOR SELECT on a deleted field

1. Certainly  after each performance.
2. IF checked, instead of FOR SELECT, interposed update certainly existing field/record. In broad gulls: all as should be.
3. The task: one script to pull out the data in table 2, and in 1 to delete this field. Here and I thought that this obvious decision. There was a parcer does not start up such construction.
DBMS bug/defect?

6

Re: IF and FOR SELECT on a deleted field

Rustam wrote:

And, it also   a field...
Yes, so it is impossible, there will be an error on .
The decision is obvious, of course, but .

Generally logically it is possible. IF should not allow to come inside.
The item with. Yes, it is possible, as it appeared parcer MERGE passes as well as should.

7

Re: IF and FOR SELECT on a deleted field

Epox0UA;
It at architecture level, EXECUTE BLOCK is prepared as uniform statement. If the field is not present, the preparation error means. It is not pleasant go there where such it is possible MS SQL, MySQL.
In Firebird "on the fly" it is not accepted to change meta data

8

Re: IF and FOR SELECT on a deleted field

Epox0UA wrote:

1. Certainly  after each performance.
2. IF checked, instead of FOR SELECT, interposed update certainly existing field/record. In broad gulls: all as should be.
3. The task: one script to pull out the data in table 2, and in 1 to delete this field. Here and I thought that this obvious decision. There was a parcer does not start up such construction.
DBMS bug/defect?

1. COMMIT does not mean unprepare
3. Substitution of concepts/changes of a context
If becomes through EXECUTE STATEMENT and it is necessary to do through it everything, including UPDATE.
It is a grenade of special system smile

9

Re: IF and FOR SELECT on a deleted field

Epox0UA> 3. The task: one script to pull out the data
Epox0UA> in table 2, and in 1 to delete this field.
It is necessary to reflect on curve architecture;
For DDL and DML (moreover in dependence
From DDL) it is not accepted to mix.
Epox0UA> It appeared a parcer does not start up such construction.
Epox0UA> a DBMS Bug/defect?
Not a bug and not a defect, and rules.
In Orakle, for example, corrected still more religiously.
It is impossible to throw out on the move the motor and
To be perturbed that the machine does not go further.

10

Re: IF and FOR SELECT on a deleted field

Epox0UA wrote:

the Task: one script to pull out the data in table 2, and in 1 to delete this field.

It not the task. It is your method of the decision of a certain task. If you will tell about the task, maybe, here prompt how to solve it without  columns on the fly.

11

Re: IF and FOR SELECT on a deleted field

The garnet are not a pity to me

execute block as
declare vN VARCHAR (250);
begin
IF (EXISTS (SELECT 1 FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME = ' T1 ' AND RDB$FIELD_NAME = ' TXT ')) THEN BEGIN
for execute statement ' select TXT from T1 ' into:vN do
----
EXECUTE STATEMENT ' ALTER TABLE T1 DROP TXT ';
end
end

12

Re: IF and FOR SELECT on a deleted field

all monkeys will be undermined;
Long live natural selection?

13

Re: IF and FOR SELECT on a deleted field

Epox0UA wrote:

a DBMS Bug/defect?

Bug and defect. But not a DBMS.

14

Re: IF and FOR SELECT on a deleted field

Gadzhimuradov Rustam if it becomes once, exclusively, for structure update  why and is not present

15

Re: IF and FOR SELECT on a deleted field

vvvait;
If it becomes for update of structure of a DB and not figs EXECUTE BLOCK to do. Write a normal script

16

Re: IF and FOR SELECT on a deleted field

Simonov Denis, suum cuique

17

Re: IF and FOR SELECT on a deleted field

vvvait> if it becomes once
If becomes once does not happen any "repeatedly".
> Exclusively, for structure update  why also is not present
If for structure update the script becomes
(And normally two separate - one on all DDL, then
Separate on DML), instead of mixed EB on 2 lines.
And normally updating structures, know from what version
(And DB structures), instead of check (though happens also such).

18

Re: IF and FOR SELECT on a deleted field

Rustam wrote:

vvvait> if it becomes once
If becomes once does not happen any "repeatedly".
> Exclusively, for structure update  why also is not present
If for structure update the script becomes
(And normally two separate - one on all DDL, then
Separate on DML), instead of mixed EB on 2 lines.
And normally updating structures, know from what version
(And DB structures), instead of check (though happens also such).

Normally, correctly, conveniently - three different essences
Transfer on new structure of a DB at us becomes performance of several tens units.
In an old DB there are fields (if they are not present), are filled by rules, or on a default.
That should be - undertakes from new structure of a DB, in the same place scripts and transfer rules. And client exe/
Then the data is stupidly poured in a new DB.  the correct structure.
In former is deleted nothing. All the same on a dustbin.
Speed - 2  basis for 20 minutes
Bonus identical structure of a DB at all customers, client  in accuracy correspond to structure.
Point No 0 - .

19

Re: IF and FOR SELECT on a deleted field

pastor> it is normal, correct, convenient - three different essences
To whom and a mare - the bride, yes.