Commit after insert in -c option of vsql

Moderator: NorbertKrupa

Post Reply
sam
Newbie
Newbie
Posts: 14
Joined: Thu Sep 12, 2013 9:48 pm

Commit after insert in -c option of vsql

Post by sam » Fri Dec 13, 2013 5:55 pm

Hi,

How do I commit an insert that is run from the vsql command line?

Code: Select all

[dbadmin@vertica01 ~]$ vsql -c "select * from jack;"
 one
-----
(0 rows)

[dbadmin@vertica01 ~]$ vsql -c "insert into jack values (1);"
 OUTPUT
--------
      1
(1 row)

[dbadmin@vertica01 ~]$ vsql -c "select * from jack;"
 one
-----
(0 rows)
See the data was not committed? Is there a command line switch for auto commit?

scutter
Master
Master
Posts: 301
Joined: Tue Aug 07, 2012 2:15 am

Re: Commit after insert in -c option of vsql

Post by scutter » Fri Dec 13, 2013 6:45 pm

vsql -c "insert into jack values (1); commit;”
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: Commit after insert in -c option of vsql

Post by id10t » Fri Dec 13, 2013 9:11 pm

Hi!

[DELETED]
Last edited by id10t on Fri May 08, 2015 9:20 pm, edited 1 time in total.

scutter
Master
Master
Posts: 301
Joined: Tue Aug 07, 2012 2:15 am

Re: Commit after insert in -c option of vsql

Post by scutter » Fri Dec 13, 2013 9:48 pm

Either way works. Neither way is “the right way”.
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC

sam
Newbie
Newbie
Posts: 14
Joined: Thu Sep 12, 2013 9:48 pm

Re: Commit after insert in -c option of vsql

Post by sam » Fri Dec 13, 2013 10:07 pm

Thanks for the quick response scutter and skWa! :D :D :D

Post Reply

Return to “vSQL”