CSV Import - Set table column to fixed value
I'm trying to import a CSV file to an existing Oracle (v19c) table and I want to set a couple of columns to fixed values like:
- “some string”
- SYSDATE (Oracle pseudo-function for the current date/time)
The first row of the CSV file has the column names, and I've checked that option in DataGrip.
Then I edited the table column mapping, replacing the pre-selected CSV column name with the fixed value.
Datagrip loads the records, and reports no errors, but the table column value is always NULL.
I've tried surrounding the string value with nothing, single quotes (Oracle's standard) and double quotes. But the result is always the same; the table column is NULL.
And trying to use the SYSDATE function in a date field causes DataGrip to raise a system error, without saving any rows.
Is this possible, or does the CSV file layout have to match the database table definition exactly?
请先登录再写评论。
Hello,
Could you please clarify if you need to insert values from CSV file or create table from CSV file?
I'm not sure if I understand your question. The first sentence of my post was:
> I'm trying to import a CSV file to an existing Oracle (v19c) table.
So I'm loading new records from the CSV file into a current table (without changing they table's definition). I want to set just a couple table columns with fixed values using either constant strings or Oracle functions (SYSDATE).
Thanks for your help.
You said “replacing the pre-selected CSV column name with the fixed value”. Could you please attach screenshot demonstrating it? If you change column name in mapping it doesn't change the values. If you need to insert some values, you may change them in CSV file.
Yaroslav Bedrov I just replied to your support email.
I thought I could simply change the mapping. It seems overly-burdensome to update the source CSV file since the column value will be a constant.
For others, this is what I'm trying to do:
https://www.dropbox.com/scl/fi/chm6e8y94bz556skji8jn/DataGrip-Import-from-File.jpg?rlkey=94a4ns68iecebx5jcqwstge7d&dl=0
If anyone's interested, Yaroslav's answer was:
My response was:
Feature request created: https://youtrack.jetbrains.com/issue/DBE-18925