Issue with Import CSV to Database V5 Smart service

Certified Senior Developer

We are using Oracle database and below is the issue:

I have a requirement to load the CSV file data into database. For this, I have created one CDT and it’s primary key is configured as auto generated. 

And I am using the “Import CSV to Database V5” smart service to load the data. 

Here I am facing an issue and data is not getting inserted into database. This smart service is showing the below error message.

“ORA-01400: Cannot insert NULL into (“APPIANBD”.”testTable”.”id”)”

Where “testTable” is the table name and “id” is the primary key. 

The other tables, for which I am loading the data using “Write to Datastore entity” smart service , they are working fine. Data is getting inserted and also id is generated automatically. 

Only for these tables, in which I am loading the data using this smart interface, I am facing this issue.

Also, If I manually update the CSV file with some id values, then the data is storing in database. Otherwise, it is not auto generating the id values and throwing the above mentioned error.

  Discussion posts and replies are publicly visible

Parents Reply
  • I had the same issue as well, but figured it out.

    I had a CDT called testTable with columns: id, firstName, lastName
    id was defined as the primary key and set to autogenerate
    Database table was built from the CDT through appian

    My spreadsheet has columns for firstName and lastName, but nothing for the id.
    Looks like the plugin was making a straight insert using the columns and data supplied without knowing or doing anything about the id field.

    like this...
    insert into testTable (firstName, lastName) values ("bob", "barker")

    The trick was to create the table and CDT in the other order.

    First manually create the table in the database with an auto increment primary key
    Next create the CDT using the option, 'Create from database table or view'
    Point your CDT to the newly created table

    Now the database knows what to do about the primary key and the import will work.

    Instructions for an auto increment pk in oracle...

    https://chartio.com/resources/tutorials/how-to-define-an-auto-increment-primary-key-in-oracle/

    Hope this helps

Children
No Data