Subject Re: Corrupt database
Author zifnabbe
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 12:01 PM 2/05/2004 +0000, you wrote:
> >Pardon my stupidity, but this is all new to me.
> >Why is the following stored procedure failing to compile?
> >
> >declare variable fkvalue varchar(11) character set ASCII;
> >declare variable x integer;
> >
> >for select PERSON_ID FROM PERSONS
> >for update
> >into :fkvalue
> >as cursor mycursor
> >do
> >begin
> > /* Procedure Text */
> > x = 1
> >end;
> >when GDSCode transliteration_failed do
> >begin
> > update persons
> > set PERSON_ID = 'XXX'
> > where current of mycursor;
> >end;
> >
> >It tells me that PERSON_ID doesn't exists (while it is a column in
> >the table).
>
> I) Is this all of your stored procedure? Or did you just omit the
CREATE
> PROCEDURE <procedure-name> AS clause to save bandwidth?

sorry. Here is the full code (I was using IBExpert):

which is now working except for the fact that at compile time I now
get the message:

"
Unknown cursor.
Dynamic SQL Error.
SQL error code = -504.
Cursor unknown.
"

CREATE PROCEDURE SP_TESTCORRUPT
AS
DECLARE VARIABLE x INTEGER;
DECLARE VARIABLE fkvalue VARCHAR(11) CHARACTER SET ASCII;

begin
for select PERSONS.person_id FROM PERSONS
for update
into :fkvalue
as cursor mycursor
do
begin
/* Procedure Text */
x = 1;
end
when GDSCode transliteration_failed do
begin
update persons
set persons.PERSON_ID = 'XXX'
where current of mycursor;
end

end;

Thanks