Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Why can't I use a dynamic parameter here?
Sun, Apr 17 2011 10:25 AMPermanent Link

Uli Becker

<<
DECLARE FAnteilProzentOPrivat INTEGER;
DECLARE FAnteilProzentOKasse INTEGER;
DECLARE Result CURSOR FOR Stmt;

PREPARE Stmt FROM
'SELECT AnteilProzentOPrivat, AnteilProzentOKasse, AnteilProzentA from
Optionen';
OPEN Result;
Fetch First From Result('AnteilProzentOPrivat','AnteilProzentOKasse')
into  FAnteilProzentOPrivat,FAnteilProzentOKasse;
CLOSE Result;

Execute Immediate '
  Update Abrechnungen
  set  AnteilProzentO = if(Privat = true then ? else ?),
  ErloesO = DRGPreis + ImplantatePreis + ZuAbschlagPreis + AbzuegePreis,
  AnteilSummeO = (ErloesO * AnteilProzentO) / 100 where IsOperateur = true'
using FAnteilProzentOPrivat, FAnteilProzentOKasse;
>>

When executing this procedure, it says:

ElevateDB Error #700 An error was found in the statement at line 16 and
column 19 (Invalid expression ? found, dynamic parameter type cannot be
inferred)

I don't understand why I can't use dynamic parameters here.

Thanks Uli

BTW: @Tim: from where do you get the line and column numbers? They never
match. Smiley
Sun, Apr 17 2011 1:22 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Uli

>I don't understand why I can't use dynamic parameters here.

I don't understand either, but I do know its not allowed in functions - either its the standard, Tim hasn't got around to it yet or its just to much like hard work SmileyI was told but I can't remember.

>BTW: @Tim: from where do you get the line and column numbers? They never
>match. Smiley

They do sometimes, they don't sometimes but I'm puzzled as to what differentiates the do's from the don'ts

At least I know its usually somewhere near.

Roy Lambert [Team Elevate]
Sun, Apr 17 2011 3:43 PMPermanent Link

Uli Becker

Roy,

> I don't understand either, but I do know its not allowed in functions

Ah, I didn't know that. Thanks.

Hopefully Tim will enable this - it's useful.

Uli
Tue, Apr 19 2011 5:55 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< I don't understand why I can't use dynamic parameters here. >>

You can't use dynamic parameters for *both* result expressions of the IF
because EDB cannot figure out how to properly type-check the expression
during compilation.   At least one of the result expressions must not be a
NULL constant or a dynamic parameter, basically something that EDB can use
to infer the result type.

<< BTW: @Tim: from where do you get the line and column numbers? They never
match. Smiley>>

They should always match.  Please send me an example and I'll take a look.

--
Tim Young
Elevate Software
www.elevatesoft.com
Mon, Apr 25 2011 7:17 AMPermanent Link

Uli Becker

Tim,

> << BTW: @Tim: from where do you get the line and column numbers? They
> never match. Smiley>>
>
> They should always match.  Please send me an example and I'll take a look.

They *do* in all cases after sending this post. Smile

Sorry - if I find something else, I'll send it to you.

Regards Uli
Image