Subject Re: [IBO] question
Author Helen Borrie
At 03:07 PM 31-01-01 -0600, you wrote:
>Hello everyone.
>I have a question regarding the SQL UPDATE command in Interbase. I hope
>someone can assist me in the problem.

Bad syntax in your SET clauses:

SET APP_REL_IMAGE_FILE.APP_SERVICE[:APP_SLOT] = :IN_SERVICE,

should be

SET APP_SERVICE[:APP_SLOT] = :IN_SERVICE,


Also, I think this statement has potential to cause grief at run-time:

APP_SLOT = :IN_START / 5;

How can you be certain that this will always evaluate to an integer?

Helen



>I am trying to use the UPDATE command inside a stored procedure. I am
>trying to update a single element within a specific column which is defined
>as an integer array. The table is defined as follows:
>
>CREATE TABLE APP_REL_IMAGE_FILE
>(
> ID Integer NOT NULL,
> Active_Date VARCHAR (10),
> Employee Integer,
> App_Service Integer [288],
> App_Client_Type Integer [288],
> App_Client Integer [288],
> App_Status VARCHAR (288),
> Internet VARCHAR (288),
>
> PRIMARY KEY (ID)
>
>);
>
>
>Here is a clip of my Stored Procedure Code.
>
>SET TERM !! ;
>
>CREATE PROCEDURE UPDATE_APPOINTMENT_IMAGE_FILE(IN_EMPLOYEE INTEGER, IN_DATE
>VARCHAR(10),
> IN_CLIENT INTEGER,IN_SERVICE INTEGER,IN_CLIENT_TYPE INTEGER,IN_START
>INTEGER,
> IN_PROCESS INTEGER,IN_INTERNET VARCHAR(1)) RETURNS(SQL_VALUE INTEGER)
>
>AS
> DECLARE VARIABLE APP_SLOT INTEGER;
> DECLARE VARIABLE APP_TIME INTEGER;
> DECLARE VARIABLE APP_LOOP INTEGER;
>BEGIN
> APP_LOOP = 1;
> APP_SLOT = :IN_START / 5;
> APP_SLOT = APP_SLOT + 1;
> APP_TIME = :IN_PROCESS / 5;
> WHILE (APP_LOOP <= APP_TIME) DO
> BEGIN
> UPDATE APP_REL_IMAGE_FILE
> SET APP_REL_IMAGE_FILE.APP_SERVICE[:APP_SLOT] = :IN_SERVICE,
> APP_REL_IMAGE_FILE.APP_CLIENT_TYPE[:APP_SLOT] =
>:IN_CLIENT_TYPE,
> APP_REL_IMAGE_FILE.APP_CLIENT[:APP_SLOT] = :IN_CLIENT,
> APP_REL_IMAGE_FILE.APP_STATUS[:APP_SLOT] = 'O',
> APP_REL_IMAGE_FILE.INTERNET[:APP_SLOT] = :IN_INTERNET
> WHERE APP_REL_IMAGE_FILE.EMPLOYEE = :IN_EMPLOYEE AND
> APP_REL_IMAGE_FILE.ACTIVE_DATE = :IN_DATE;
> APP_LOOP = APP_LOOP + 1;
> APP_SLOT = APP_SLOT + 1;
> END
>END!!
>
>SET TERM ; !!
>
>I Keep getting a Error for the first SET line because it does not like the
>"[" when I try to add this stored procedure with the ISQL tool.
>
>How am I suppose to do this???
>
>
>Michael Kim
>MIS Department
>Visible Changes, Inc.
>mkim@...
>
>
>
>
>

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________