Can scriptella "merge" data?

148 views
Skip to first unread message

Andres Olarte

unread,
Feb 20, 2013, 10:29:55 AM2/20/13
to scrip...@googlegroups.com
Here's my use case, and I'm wondering if scriptella can do this:

I have a table preferences with 4 fields:

id long (PK),
name text,
label text,
value text,

I want to import a row, which means, if it's not there, I insert a new row.  If a row matching the name column (not the PK) is there, I update some of the fields (for example I update label, but not name or value).  In this case I don't know what the id is, nor do I care what it is if I need to import.

Can this be easily achievable, even if it requires a bit of Java coding ?

Thanks

Fyodor Kupolov

unread,
Feb 21, 2013, 3:16:51 PM2/21/13
to scrip...@googlegroups.com
Hi,

I think upsert or merge into should help in your case http://scriptella.javaforge.com/faq.html#UPSERT 

Regards,
Fyodor

Andres Olarte

unread,
Mar 16, 2013, 10:07:52 AM3/16/13
to scrip...@googlegroups.com
Thanks, I'm using postgresql, so I had to use a solution a little bit different, as detailed here: http://stackoverflow.com/questions/1109061/insert-on-duplicate-update-postgresql
Reply all
Reply to author
Forward
0 new messages