Duplicate_id |
---|
100387 |
100387 |
100387 |
Requirement: I have column Duplicate_id
that contains numeric values OR NULL (might have some NUMBER_NUMBER type values too). I need to convert this column to a varchar
while inserting.
Procedure
I'm using the below commands to insert data into table.
CREATE OR REPLACE TABLE TEMP_TABLE (Duplicate_id VARCHAR(256));
Creating stage and putting my above csv file on that stage and uploading data from that stage into my table.
COPY INTO TEMP_TABLE from @stage/my_file.csv.gz;
Issue: after inserting, I'm getting .0
appended after every NOT NULL value.
Duplicate_id |
---|
100387.0 |
Could someone help in understanding why this is happening?
Thanks!
This can be related to auto conversion. So, pls load the data first in a stage table. In stage table mention this as string.
Then use below function to convert it.
to_char(to_number(stage.Duplicate_id)) Duplicate_id
to_number
- this ensures there is no .0
in th end.