Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 2 of 2 total |
some weird #1011 error I'm getting |
Wed, Jan 25 2012 7:18 AM | Permanent Link |
Lucian | Hi,
I'm having problems with this code and I'm stuck. I have a stored boolean function, declared as: CREATE FUNCTION "uspHasFlag" ( IN "Value" INTEGER, IN "Flag" INTEGER) RETURNS BOOLEAN ........... than, this gets called from another stored procedure with (a piece of) code like: Form 1: SET sqlCheckFlag = 'uspHasFlag(SELECT Flags FROM apartamente WHERE (apartamente.AptNo=tabel.AptNo) AND (apartamente.ScaraID=?), ?)'; PREPARE AuxStatement FROM 'SELECT Sum(Nrp) NrpCuContor, Sum('+ColumnConsum+') ConsumDeclarat '+ 'FROM tabel '+ 'JOIN consumuri ON (consumuri.ScaraID=tabel.ScaraID) AND (consumuri.AptNo=tabel.AptNo) '+ 'JOIN apartamente ON (apartamente.ScaraID=tabel.ScaraID) AND (apartamente.AptNo=tabel.AptNo) AND ' + sqlCheckFlag + ' WHERE (ScaraID=?) AND (Perioada=?) NOJOINOPTIMIZE'; OPEN AuxCursor USING ScaraID, Flag, ScaraID, Perioada; Now, the code above works fine WHEN this is used: Form 2: SET sqlCheckFlag = 'uspHasFlag(SELECT Flags FROM apartamente WHERE (apartamente.AptNo=tabel.AptNo), ?)'; but it craps when the first form is used. I am getting: #1011 An error occurred with the value uspHasFlag(SELECT Flags FROM apartamente WHERE (apartamente.AptNo=tabel.AptNo) AND (apartamente.ScaraID=?), ?) (The value would result in truncation)) I don't understand the error. Since the second approach works fine, I was expecting that adding another filter will make the SELECT even more restrictive ... so, I don't understand the error. |
Wed, Jan 25 2012 7:53 AM | Permanent Link |
Lucian | Forget about it. The variable was declared as VARCHAR(100) and obviously didn't fit
Lucian |
This web page was last updated on Tuesday, May 7, 2024 at 02:40 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |