当前位置: 首页 > 知识库问答 >
问题:

数据正确的号码 ORA-01722 无效

宋腾
2023-03-14

执行SQLDRI后日志的错误正在尝试在字段中插入数值,但我一直收到相同的错误 无效数字ORA-01722。我不知道错误在哪里,因为我插入了声明为NUMBER(18,6)的十进制数作为字段IMP_NPVFRONT并且值被强制转换为此长度,但它不起作用。我正在使用这个代码

echo "OPTIONS (SKIP=1)" >> $TEPR_NFICHCONTROLCTL
echo "LOAD DATA" >> $TEPR_NFICHCONTROLCTL
echo "APPEND" >> $TEPR_NFICHCONTROLCTL
echo "INTO TABLE TERM.TTERMNZI" >> $TEPR_NFICHCONTROLCTL
echo "FIELDS TERMINATED BY ';' ">> $TEPR_NFICHCONTROLCTL
echo "OPTIONALLY ENCLOSED BY '\"' " >> $TEPR_NFICHCONTROLCTL
echo "TRAILING NULLCOLS" >> $TEPR_NFICHCONTROLCTL
echo "(" >> $TEPR_NFICHCONTROLCTL
echo " COD_CURRPL CHAR NULLIF COD_CURRPL=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " COD_IDINST INTEGER EXTERNAL," >> $TEPR_NFICHCONTROLCTL
echo " COD_COUNTER CHAR NULLIF COD_COUNTER=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " XTI_INTERNA CHAR NULLIF XTI_INTERNA=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " COD_PRTFOLIO CHAR NULLIF COD_PRTFOLIO=\"\",">> $TEPR_NFICHCONTROLCTL
echo " COD_FAMILY CHAR NULLIF COD_FAMILY=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " COD_GRUPO CHAR NULLIF COD_GRUPO=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " COD_TIPOPER CHAR NULLIF COD_TIPOPER=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " FEC_EXPIRY DATE \"DD/MM/RRRR\"," >> $TEPR_NFICHCONTROLCTL
echo " COD_STATUS CHAR NULLIF COD_STATUS=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " FEC_INICIO   DATE \"DD/MM/RRRR\"," >> $TEPR_NFICHCONTROLCTL
echo " COD_INSTRMNT CHAR NULLIF COD_INSTRMNT=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " COD_ENTITY CHAR NULLIF COD_ENTITY=\"\"," >> $TEPR_NFICHCONTROLCTL
echo " IMP_NONFMV CHAR \"to_number(:IMP_NONFMV, '999999999999999999D999999', 'NLS_NUMERIC_CHARACTERS = ''.,''')\"," >> $TEPR_NFICHCONTROLCTL
echo " IMP_CAMBIO CHAR \"to_number(:IMP_CAMBIO, '999999999999999999D999999', 'NLS_NUMERIC_CHARACTERS = ''.,''')\","  >> $TEPR_NFICHCONTROLCTL
echo " COD_APLICFO CHAR,"  >> $TEPR_NFICHCONTROLCTL
echo " IMP_NPVFRONT CHAR \"to_number(:IMP_NPVFRONT,'999999999999999999D999999', 'NLS_NUMERIC_CHARACTERS = ''.,''')\"," >> $TEPR_NFICHCONTROLCTL
echo " FEC_PROCESO \"to_date('$3', 'DD/MM/RRRR')\" ," >> $TEPR_NFICHCONTROLCTL
echo " COD_FICHERIN CONSTANT \"$4\" ," >> $TEPR_NFICHCONTROLCTL
echo " FEC_LOADER SYSDATE ," >> $TEPR_NFICHCONTROLCTL
echo " XTI_ESTADO CONSTANT 0 " >> $TEPR_NFICHCONTROLCTL
echo " )" >> $TEPR_NFICHCONTROLCTL

echo "$TEPR_HLOG Fichero de control $TEPR_NFICHCONTROLCTL generado correctamente"

echo "$TEPR_HLOG Fin Ejecucion de: $TEPR_NSCRIPT"

exit 0

上面生成了一个包含以下内容的控制文件:

OPTIONS (SKIP=1)
LOAD DATA
APPEND
INTO TABLE TERM.TTERMNZI
FIELDS TERMINATED BY ';' 
OPTIONALLY ENCLOSED BY '"' 
TRAILING NULLCOLS
(
 COD_CURRPL CHAR NULLIF COD_CURRPL="",
 COD_IDINST INTEGER EXTERNAL,
 COD_COUNTER CHAR NULLIF COD_COUNTER="",
 XTI_INTERNA CHAR NULLIF XTI_INTERNA="",
 COD_PRTFOLIO CHAR NULLIF COD_PRTFOLIO="",
 COD_FAMILY CHAR NULLIF COD_FAMILY="",
 COD_GRUPO CHAR NULLIF COD_GRUPO="",
 COD_TIPOPER CHAR NULLIF COD_TIPOPER="",
 FEC_EXPIRY DATE "DD/MM/RRRR",
 COD_STATUS CHAR NULLIF COD_STATUS="",
 FEC_INICIO   DATE "DD/MM/RRRR",
 COD_INSTRMNT CHAR NULLIF COD_INSTRMNT="",
 COD_ENTITY CHAR NULLIF COD_ENTITY="",
 IMP_NONFMV CHAR "to_number(:IMP_NONFMV, '999999999999999999D999999', 'NLS_NUMERIC_CHARACTERS = ''.,''')",
 IMP_CAMBIO CHAR "to_number(:IMP_CAMBIO, '999999999999999999D999999', 'NLS_NUMERIC_CHARACTERS = ''.,''')",
 COD_APLICFO CHAR,
 IMP_NPVFRONT CHAR "to_number(:IMP_NPVFRONT,'999999999999999999D999999', 'NLS_NUMERIC_CHARACTERS = ''.,''')",
 FEC_PROCESO "to_date('', 'DD/MM/RRRR')" ,
 COD_FICHERIN CONSTANT "" ,
 FEC_LOADER SYSDATE ,
 XTI_ESTADO CONSTANT 0 
 )

提前谢谢你,对不起我的英语:)

创建表:

CREATE TABLE TTERMNZI 
(
  COD_IDINST VARCHAR2(150 BYTE) NOT NULL 
, COD_FICHERIN VARCHAR2(20 BYTE) 
, FEC_PROCESO DATE 
, COD_OPERORI VARCHAR2(100 BYTE) 
, XTI_ESTADO NUMBER(1, 0) 
, COD_ESTADO NUMBER(4, 0) 
, COD_PRTFOLIO VARCHAR2(20 BYTE) 
, COD_DEALID VARCHAR2(20 BYTE) 
, COD_EVENT VARCHAR2(20 BYTE) 
, COD_CURRCON VARCHAR2(20 BYTE) 
, COD_COUNTER VARCHAR2(20 BYTE) 
, FEC_ALTA DATE 
, FEC_MATURITY DATE 
, FEC_FRONTVAL DATE 
, FEC_RKVAL DATE 
, IMP_NPVFRNEU NUMBER(18, 6) 
, IMP_NPVBO NUMBER(18, 6) 
, IMP_NPVBOEU NUMBER(18, 6) 
, COD_CURRPL VARCHAR2(4 BYTE) 
, IMP_MVPAGO NUMBER(18, 6) 
, IMP_MVRECIBO NUMBER(18, 6) 
, IMP_MVCONSA NUMBER(18, 6) 
, IMP_MVCONEU NUMBER(18, 6) 
, COD_FAMILY VARCHAR2(20 BYTE) 
, COD_GRUPO VARCHAR2(20 BYTE) 
, COD_STATUS VARCHAR2(8 BYTE) 
, COD_TIPOPER VARCHAR2(4 BYTE) 
, FEC_EXPIRY DATE 
, FEC_INICIO DATE 
, COD_INSTRMNT VARCHAR2(20 BYTE) 
, COD_ENTITY VARCHAR2(20 BYTE) 
, COD_APLICFO VARCHAR2(5 BYTE) NOT NULL 
, FEC_LOADER DATE 
, COD_USUARIO VARCHAR2(5 BYTE) 
, XTI_INTERNA VARCHAR2(1 BYTE) 
, IMP_NONFMV NUMBER(18, 6) 
, IMP_CAMBIO NUMBER(18, 6) 
, IMP_NPVFRONT NUMBER(18, 6) 
, CONSTRAINT CTERMNZI PRIMARY KEY 
  (
    COD_IDINST 
  , COD_APLICFO 
  )
  USING INDEX 
  (
      CREATE UNIQUE INDEX CTERMNZI ON TTERMNZI (COD_IDINST ASC, COD_APLICFO 
ASC) 
      LOGGING 
      TABLESPACE ETERM01 
      PCTFREE 10 
      INITRANS 2 
      STORAGE 
      ( 
        INITIAL 65536 
        NEXT 1048576 
        MINEXTENTS 1 
        MAXEXTENTS UNLIMITED 
        BUFFER_POOL DEFAULT 
      ) 
      NOPARALLEL 
  )
  ENABLE 
) 
LOGGING 
TABLESPACE ETERM01 
PCTFREE 10 
INITRANS 1 
STORAGE 
( 
  INITIAL 65536 
  NEXT 1048576 
  MINEXTENTS 1 
  MAXEXTENTS UNLIMITED 
  BUFFER_POOL DEFAULT 
) 
NOCOMPRESS 
NOPARALLEL;

数据文件:

EST;3773909;8EUK;N;RF_STARTY;IRD;BOND;S;18/10/2024;LIVE;25/09/2020;OCD 0 184534;0018234537;-2402029;1;0;MX;-2402029.000000
EST;8223589;A4805;N;SW_STARTY;IRD;IRS;B;22/12/2045;LIVE;29/09/2014;EUROPE;001345297;-217726.721335;1;0;MX;-217726.721335

共有1个答案

东门晟
2023-03-14

问题似乎是IMP_NPVFRONT在两个示例记录中都具有值“MX”,从而导致在尝试对其应用to_number表达式时出错。

 类似资料:
  • 我在包裹抛出错误中有一个查询 ORA-01722:无效号码。 我试了很多方法,但都没有成功。 null 请给我建议解决办法

  • 我正在尝试执行查询,但它不断给出错误 ORA-01722:无效号码01722.00000-"无效号码" 我检查了是否有像01722这样的数字。00000或类似在我的表中,但没有。我还检查了查询,如果我在非数值中使用算术运算符,如果我正在比较一个数字和非数字值,但仍然什么都没有。我所有的表列都是类型,现在已经一整天了,我还没有找到如何解决它。查询如下:

  • 这是我的桌子。 我运行此插入语句 我得到这个错误信息: 从命令中的第1行开始出错-插入计划(SCHEDULE_IDARRV_TIMEDEP_TIMEBUS_TRANSFERSBUS_IDTRAVEL_DIRECTIONWEEK_DAY)值(SEQ_SCHEDULE.NEXTVAL,'10','11','White Oak','2','North','4') 错误报告-SQL错误:ORA-01722

  • 我看了无数的帖子,但我仍然没有答案。 在此之前,我运行了一个脚本,告诉sql developer充当discoverer(一个已经创建的包),但是当运行查询时,它返回ORA-01722:无效数字。 我从包中选择了对偶,它返回值。 有人能告诉我为什么它会返回此错误消息的正确方向吗?

  • 一个非常容易的人,下面的插入是给我

  • 我有一个问题是随机产生的(千次调用之间的一次)。错误ORA-01722:在准备好的语句Oracle数据库中执行sql更新时,以随机方式生成了无效的数字。个案详情如下: log中的值如下所示: 通过在DB处跟踪查询参数,所有参数都通过JDBC驱动程序正确传输,但参数23410984除外,它被值替换(注意,该值在char'u'之前包含回车)。我不知道为什么