请问这个错误是什么意思?怎么产生的?

gotolwd 2003-12-18 04:25:36
select error :decimal conversion error,powerbuilder only support 18 decimal digits

我的数据库里的两个字段,id (numeric),val(varchar 600)
我从其他表里取出值给cur_id,最后运行时会产生这样的错误
string sql
long cur_id
currow = row
cur_id = dw_1.getitemdecimal(currow,'id')
sql="SELECT val FROM table where id='"+string(cur_id)+"'"
dw_2.setsqlselect(sql)
dw_2.retrieve()
...全文
112 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
tulip2108 2003-12-19
  • 打赏
  • 举报
回复
Long

32-bit signed integers, from -2147483648 to +2147483647.
Using literals Use literals as for integers, but longer numbers are permitted.
Decimal or Dec

Signed decimal numbers with up to 18 digits. You can place the decimal point anywhere within the 18 digits梖or example, 123.456, 0.000000000000000001 or 12345678901234.5678.
字段类型定义错了。
string sql
decimal cur_id //原来为long
currow = row
cur_id = dw_1.getitemdecimal(currow,'id')
sql="SELECT val FROM table where id = " + string(cur_id)
dw_2.setsqlselect(sql)
dw_2.retrieve()
tulip2108 2003-12-19
  • 打赏
  • 举报
回复
Test Note 4: PowerBuilder only supports Decimals up to a Maximum Precision of 18

PowerBuilder only supports decimals to a maximum precision of 18 characters. Test attempts to retrieve columns defined with precision greater than 18 resulted in a message similar to the following:

"SQL Preview...Select error: Decimal conversion error. PowerBuilder only supports 18 decimal digits."

gotolwd 2003-12-19
  • 打赏
  • 举报
回复
hehe,我昨天晚上有事,没来,而且也没有说清楚,我是在
sql="SELECT val FROM table where id = " + string(cur_id)
不好使后换的帖子上的语句的,拷贝的时候忘改了,其实就是这两句都出现同一个问题
产生的是同一条错误
小子侯 2003-12-19
  • 打赏
  • 举报
回复
类型重新定义一下,sql语句改为以下
deciaml cur_id
sql="SELECT val FROM table where id='"+string(cur_id)+"'"这句有问题,改为:

sql="SELECT val FROM table where id = " + string(cur_id)

//因为cur_id定义为了数值型所以不直接把其转换为字符类型给id即可不必要加引号
gotolwd 2003-12-19
  • 打赏
  • 举报
回复
呵呵,你说的做法我也做过了,但是情况依旧阿
huangxinru 2003-12-18
  • 打赏
  • 举报
回复
sql="SELECT val FROM table where id='"+string(cur_id)+"'"
改成
sql="SELECT val FROM table where id='"+string(cur_id,0)+"'"
mittee 2003-12-18
  • 打赏
  • 举报
回复
楼上正确
wwwafa9 2003-12-18
  • 打赏
  • 举报
回复
sql="SELECT val FROM table where id='"+string(cur_id)+"'"这句有问题,改为:

sql="SELECT val FROM table where id = " + string(cur_id)

609

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧