[SQL] running scripts like oracle sqlplus

2010-06-21 Thread Steven Dahlin
I have been trying to figure out how I can run a pgsql script like I can run a plsql script with oracle's sqlplus. Here is a sample script file for what I want to run: declare sysuserid integer := 0; hwcustid integer := 0; begin select nextval( 'user_seq' ) into sysuserid; select nextval(

Re: [SQL] running scripts like oracle sqlplus

2010-06-21 Thread Kenneth Marshall
On Fri, Jun 18, 2010 at 04:24:18PM -0600, Steven Dahlin wrote: > I have been trying to figure out how I can run a pgsql script like I can run > a plsql script with oracle's sqlplus. Here is a sample script file for what > I want to run: > > declare > sysuserid integer := 0; > hwcustid intege

Re: [SQL] running scripts like oracle sqlplus

2010-06-21 Thread Brian Sherwood
Have you tried nextval & currval? http://www.postgresql.org/docs/8.4/interactive/functions-sequence.html Something like this: begin insert into user ( user_id, customer_id, create_user, update_user ) values ( nextval(user_seq), nextval(customer_seq), currval(user_seq), currval(u