Re: [SQL] Atomic query and update of sequence generators

2004-01-14 Thread Tom Lane
Jeffrey Tenny <[EMAIL PROTECTED]> writes: > If I want to allocate a block of adjacent values from a sequence generator, > is the following statement atomic with respect to the time between > when the call to nextval() and setval()? > SELECT setval('foo', nextval()+20) ... Nope. > The goal is to

Re: [SQL] REPOST[GENERAL] Quoting for a Select Into - Please Help

2004-01-14 Thread Stuart Barbee
Alex, Postgres's "select into" does not work like oracle. The "select into" for postgresql creates another table. Try this; select aliasvalue || trim(arrayval[i]) into newtablename from currenttablename where trim(searchfield) like '%' || trim(searchvalue) || '%'; Stuart --- A E <[EMAIL

[SQL] Atomic query and update of sequence generators

2004-01-14 Thread Jeffrey Tenny
If I want to allocate a block of adjacent values from a sequence generator, is the following statement atomic with respect to the time between when the call to nextval() and setval()? SELECT setval('foo', nextval()+20) ... The goal is to get a sequence of 20 values that are all +1 from each other.

[SQL] REPOST[GENERAL] Quoting for a Select Into - Please Help

2004-01-14 Thread A E
Hi,   Could someone help me with quoting this right?   select into aliasvalue ''|| trim(arrayval[i]) ||''  from ''|| trim(realname) ||'' where ''|| trim(searchfield) ||'' like %''|| trim(searchvalue) ||''%;   The parser does not seem to want to put the value of the variables into the

Re: [SQL] Transpose rows to columns

2004-01-14 Thread Luis C. Ferreira (aka lcf)
El Lun 12 Ene 2004 22:12, David Witham escribió: >DW: Hi, >DW: >DW: I have a query that returns data like this: >DW: >DW: cust_idcust_name month costrevenue margin >DW: 991234 ABC 2003-07-01 10 15 5 >DW: 991234

Re: [SQL] Insert into:Bad date external representation

2004-01-14 Thread Michael Glaesemann
On Jan 14, 2004, at 4:39 PM, [EMAIL PROTECTED] wrote: got an error as below : dwnc=> insert into biosadm.custdo_dim dwnc-> (do_key,do_no,do_date,attnto,custlo) dwnc-> select nextval('cdo_seq'),c.dono::varchar,c.dodate::date, dwnc-> c.attnto, c.custlo from custdo_temp c; ERROR: Bad date ext

Re: [SQL] Insert into:Bad date external representation

2004-01-14 Thread azwa
Hi,  got an error as below :    dwnc=> insert into biosadm.custdo_dim dwnc->  (do_key,do_no,do_date,attnto,custlo) dwnc->  select nextval('cdo_seq'),c.dono::varchar,c.dodate::date, dwnc-> c.attnto, c.custlo  from custdo_temp c; ERROR:  Bad date external representation '' Table structure (cu