创建一个oracle表 - Double / Decimal中的字段 [英] Create an oracle table - Fields in Double / Decimal

查看:1279
本文介绍了创建一个oracle表 - Double / Decimal中的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的C#程序中,我有一段代码来创建Oracle表。该表有两个字段,X和Y,它们应该是数据类型的double。如果我设置... X double,Y double,...,我收到一个错误:ORA-00905:缺少关键字。但是,如果我将数据类型更改为十进制,则代码会通过。然后,当我动态地将记录插入表中时,保存的X& Y值是表中的整数值,而不是双原始源。表中X / Y的数据类型是Number。如何解决这个问题?提前致谢。

In my C# program, I have a piece of code to create an Oracle table. The table has two fields, X and Y, which should be in double in data type. If I set " ... X double, Y double, ...", I receive an error: ORA-00905: missing keyword. However, if I changed the data type as decimal, it code went through. Then, when I insert records into the table dynamically, the saved X & Y values are integer values in the table rather than as double original source. The data type of X/Y in the table is Number. How can this problem be fixed? Thanks in advance.

using (OracleCommand cmd = new OracleCommand( "create table " + tblName +
    "(  IIT Varchar2(7) NOT NULL, ETime Number, TrainID Number, CarNo Number, " +
    "   DestinationNo Number, TrkID Varchar2(12), TrackName Varchar2(2), " +
    "   Others Varchar2(10), X decimal, Y decimal  )", connection) )

推荐答案

我不确定 DOUBLE 是否是Oracle中的有效数据类型。请尝试 FLOAT NUMBER
I'm not sure if DOUBLE is a valid data type in Oracle. Try FLOAT or NUMBER instead.


这篇关于创建一个oracle表 - Double / Decimal中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆