[英]CognosTM1 Error: Syntax Error on or before Value
I am trying to insert a Numeric value( mesure ) to database from Tm1 cube.我正在尝试从 Tm1 多维数据集将数值( mesure )插入数据库。 The variable 'Value' type in tm1 is a Numeric, and the 'Value' type in Database is decimal.
tm1 中的变量“Value”类型为 Numeric,Database 中的“Value”类型为十进制。
I tried to do a check if the variable contains string values, so I put them in a sperated file.我试图检查变量是否包含字符串值,所以我将它们放在一个单独的文件中。 And if they are Numeric I insert them in the database.
如果它们是数字,我将它们插入数据库。
But it seems that there is an error in my sql query which states:但似乎我的 sql 查询中有错误,其中指出:
Syntax Error on or before Value
I dont know why it gives me an error even I checked o it and verified if it is Numeric.我不知道为什么它给我一个错误,即使我检查了它并验证它是否是数字。
Here is a snippet of my code:这是我的代码片段:
zType = DTYPE( 'Sales', Sales );
IF(zType @= 'N');
SQL_INSERT_N2 = 'INSERT INTO DB VALUES ( '''| dim1|''' , '''| dim2|''', '''|Value|''') ' ; #error in this line
ELSE;
zValue =NumberToString( Value ) ;
zText = dim1 | ';' | dim2 | ';' | Value | ;
ASCIIOUTPUT( zFile, zText );
ENDIF;
The problem was that I was declaring a numeric value as a string value by adding '''|Value|'''
.问题是我通过添加
'''|Value|'''
将数值声明为字符串值。
So it should be something like this:所以它应该是这样的:
SQL= 'INSERT INTO DB VALUES ( '''| dim1|''' , '''| dim2|''', '|NumberToString(Value)|') ' ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.