Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread What is wrong with this function
Tue, Jun 21 2022 5:24 AMPermanent Link

Yusuf Zorlu

MicrotronX - Speditionssoftware vom Profi

CREATE FUNCTION "mxWeekofYear" (IN "InputDate" DATE)
RETURNS INTEGER
BEGIN
  declare myDAY integer;
  declare myWEEK float;
  DECLARE RESULT integer;
  set myDAY=extract(dayofyear from InputDate);
  set myWEEK=round(myDay/7,1);
  set myWEEK=if(myWEEK<1 then 1 else myWEEK );
  set myWEEK=if(round(myWEEK,0)<myWEEK then round(myWEEK,0)+1 else
round(myWEEK,0));
  set RESULT=CAST(myWEEK as integer);
  RETURN RESULT;
END
VERSION 1.00


If i call it within EDB-Manager it works but if i call it from
client-connection I get this error:

SQL: select mxweekofyear(a_ladedate) from positionen

Error: Exception: ElevateDB Error #700 An error was found in the
statement at line 1 and column 29 (Expected ) but instead found FROM)

--
--
Yusuf Zorlu | MicrotronX
Tue, Jun 21 2022 5:34 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Yusuf


This line

  set RESULTĘST(myWEEK as integer);

is the problem

RESULTĘST is not declared and I have no idea what the line is meant to do.

I'm very surprised it worked in EDBManager - it doesn't in mine - won't even prepare

Roy Lambert
Tue, Jun 21 2022 5:39 AMPermanent Link

Yusuf Zorlu

MicrotronX - Speditionssoftware vom Profi

Roy Lambert wrote:

> Yusuf
>
>
> This line
>
>    set RESULTJST(myWEEK as integer);
>
> is the problem
>
> RESULTJST is not declared and I have no idea what the line is meant
> to do.
>
> I'm very surprised it worked in EDBManager - it doesn't in mine -
> won't even prepare
>
> Roy Lambert

Hi Roy, from where do you have the "RESULTJST(myWEEK as integer);"

--
--
Yusuf Zorlu | MicrotronX
Tue, Jun 21 2022 5:41 AMPermanent Link

Yusuf Zorlu

MicrotronX - Speditionssoftware vom Profi

Yusuf Zorlu wrote:

> CREATE FUNCTION "mxWeekofYear" (IN "InputDate" DATE)
> RETURNS INTEGER
> BEGIN
>    declare myDAY integer;
>    declare myWEEK float;
>    DECLARE RESULT integer;
>    set myDAY=extract(dayofyear from InputDate);
>    set myWEEK=round(myDay/7,1);
>    set myWEEK=if(myWEEK<1 then 1 else myWEEK );
>    set myWEEK=if(round(myWEEK,0)<myWEEK then round(myWEEK,0)+1 else
> round(myWEEK,0));
>    set RESULT=CAST(myWEEK as integer);
>    RETURN RESULT;
> END
> VERSION 1.00
>
>
> If i call it within EDB-Manager it works but if i call it from
> client-connection I get this error:
>
> SQL: select mxweekofyear(a_ladedate) from positionen
>
> Error: Exception: ElevateDB Error #700 An error was found in the
> statement at line 1 and column 29 (Expected ) but instead found FROM)


It works as expected without problems now, it was internal "replace"
problem ... nothing to do with edb.

--
--
Yusuf Zorlu | MicrotronX
Tue, Jun 21 2022 6:33 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Yusuf


One thing that is always worth remembering is thet EDBManager is just another application written in Delphi and used ElevateDB. If it works in there it should work in your application. If it doesn't there's (generally) a problem with your application.

I've lost count of the number of times I've had that sort of problem.

Roy Lambert
Image