Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue in writing csv file to table

Mrudula BandaruDec 26 2015 — edited Dec 27 2015

Hi,

I am writing Jython script to read csv file and write to table. in sql developer

But I am getting below error when I am using cursor. Please suggest if I can use cursor for jdbc connection

cur = conn.cursor()

AttributeError: 'oracle.jdbc.driver.T4CConnection' object has no attribute 'cursor'

Thanks

Comments

Mrudula Bandaru

Hi All,

I tried to remove cursor and used split to split csv record to columns

cr = csv.reader(open("D:/test.csv","r"))

for line in cr:

    vlist = line.split(',')

but, getting below error:

AttributeError: 'list' object has no attribute 'split'

Any help on the code to split csv record to columns so that we can insert the same to table..

Mrudula Bandaru

Hi,

I could manage to write .csv to table, but it is picking only the last record in the csv file. Anything I am missing here to get complete record set in the file.

alist = []
for rows in cr:
     alist.append(rows)
     to_db = [(rows[0]),(rows[1])]
  

my insert statement - INSERT INTO ACT_T(ACT,DESC)VALUES(?,?)

user17

Can you post your entire script? All i could see is that you are trying to add first two elements from the rows to the table.

1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 24 2016
Added on Dec 26 2015
3 comments
1,076 views