I found that there is a record inserted in a table of our client's production database. I cannot select one field of that record but I can select other fields by SELECT SQL statement.
A_TABLE
-------------------
|COL_A|COL_B|COL_C|
-------------------
|.....|.....|.....|
-------------------
|.....|.....|.....|
-------------------
|.....|.....|.....|
-------------------
"Invalid character encountered in" is shown as the query result by running this SQL statement:
select * from A_TABLE where COL_A = 2;
Query result: Invalid character encountered in
However, this statement could be run successfully:
select COL_A, COL_C from A_TABLE where COL_A = 2;
Query result:
-------------
|COL_A|COL_C|
-------------
| 2 |.....|
-------------
There should be invalid character encountering in the COL_B field of A_TABLE that the COL_A value is 2. Do you have idea why the COL_B contains invalid character? I would like to try to create a row of record which is similar with the row which COL_A value is 2 in A_TABLE. What should I do by INSERT or other method?
Actually, I have other questions before I ask this question...
More detailed version: However, the information about the table of this question has been simplified. You may see the almost original information is mentioned as below but I have renamed the names of the table and fields for confidential reason for protecting our client.
A_TABLE (almost original version)
---------------------------------------
|COL_A|COL_B|.............|COL_R|COL_S|
---------------------------------------
|.....|.....|.............|.....|.....|
---------------------------------------
|.....|.....|.............|.....|.....|
---------------------------------------
|.....|.....|.............|.....|.....|
---------------------------------------
Here is the CREATE SQL for the A_TABLE table (but I copied and amended from the SQL in the UAT database. It should be the same as the production but I am not sure):
CREATE TABLE "DBA"."A_TABLE"
( "COL_A" NUMBER(10,0) NOT NULL ENABLE,
"COL_B" VARCHAR2(8 BYTE) NOT NULL ENABLE,
"COL_C" VARCHAR2(3 BYTE),
"COL_D" NUMBER(4,0) NOT NULL ENABLE,
"COL_E" VARCHAR2(1 BYTE) NOT NULL ENABLE,
"COL_F" VARCHAR2(1 BYTE) NOT NULL ENABLE,
"COL_G" VARCHAR2(122 BYTE),
"COL_H" VARCHAR2(160 BYTE),
"COL_I" VARCHAR2(1 BYTE) NOT NULL ENABLE,
"COL_J" NUMBER(6,0) NOT NULL ENABLE,
"COL_K" VARCHAR2(16 BYTE) NOT NULL ENABLE,
"COL_L" VARCHAR2(50 BYTE),
"COL_M" DATE,
"COL_N" VARCHAR2(1 BYTE) NOT NULL ENABLE,
"COL_O" "SYS"."XMLTYPE" NOT NULL ENABLE,
"COL_P" DATE NOT NULL ENABLE,
"COL_Q" DATE NOT NULL ENABLE,
"COL_R" VARCHAR2(16 BYTE) NOT NULL ENABLE,
"COL_S" VARCHAR2(3 BYTE),
CONSTRAINT "A_TABLE_PK" PRIMARY KEY ("COL_K")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TABLESPACE_X" ENABLE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TABLESPACE_S"
XMLTYPE COLUMN "COL_O" STORE AS BASICFILE CLOB (
TABLESPACE "TABLESPACE_S" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
NOCACHE LOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) ;
CREATE INDEX "DBA"."A_TABLE_IDX1" ON "DBA"."A_TABLE" ("COL_A", "COL_B")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TABLESPACE_X" ;
CREATE INDEX "DBA"."A_TABLE_IDX2" ON "DBA"."A_TABLE" ("COL_P")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TABLESPACE_X" ;
CREATE INDEX "DBA"."A_TABLE_IDX3" ON "DBA"."A_TABLE" ("COL_B", "COL_D")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TABLESPACE_X" ;
CREATE UNIQUE INDEX "DBA"."A_TABLE_IDX4" ON "DBA"."A_TABLE" ("COL_B", "COL_D", "COL_E")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TABLESPACE_X" ;
CREATE INDEX "DBA"."A_TABLE_IDX5" ON "DBA"."A_TABLE" ("COL_Q", "COL_E")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING
STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "TABLESPACE_X" ;
Therefore, some information of my question should be changed here for aligning to the information in almost original version:
"Invalid character encountered in" is shown as the query result by running this SQL statement:
select * from A_TABLE where COL_B = 00000002;
Query result: Invalid character encountered in
However, this statement could be run successfully:
--this statement selects all fields of the table except COL_O
select COL_A, COL_B, ..., COL_R, COL_S from A_TABLE where COL_A = 00000002;
Query result (without COL_O field):
------------------------------------------
|COL_A| COL_B |.............|COL_R|COL_S|
------------------------------------------
|.....|00000002|.............|.....|.....|
------------------------------------------
I should rephrase my question here (in the more detailed part): There should be invalid character encountering in the COL_O field of A_TABLE that the COL_B value is 00000002. Do you have idea why the COL_O contains invalid character? I would like to try to create a row of record which is similar with the row which COL_B value is 00000002 in A_TABLE. What should I do by INSERT or other method?