Re: [SQL] Translate Function PL/pgSQL to SQL92

2010-12-16 Thread Filip RembiaƂkowski
2010/12/16 serviciotdf > Hello, > > I have a Function in PL/pgSQL and I need to translate it to SQL92, but I'm > stuck. > > ### > CREATE OR REPLACE FUNCTION pruebas(varchar, varchar, integer) > RETURNS SETOF personal AS > $delimiter$ > BEGIN > PERFORM id from documentos WHERE descripcion = $1; >

Re: [SQL] Database consistency after a power shortage

2010-12-16 Thread Jean-David Beyer
Samuel Gendler wrote: > > > On Wed, Dec 15, 2010 at 11:38 PM, Scott Marlowe > wrote: > > On Wed, Dec 15, 2010 at 8:12 AM, Alberto > wrote: > > > > > Is there any way to make the 3 operations be one transaction for the

[SQL] UPDATE in a specific order

2010-12-16 Thread Luiz K. Matsumura
Hi, I have a follow scenario: CREATE TABLE table1 ( id integer , vlpr numeric(10,2) , vlab numeric(10,2) , vlbx numeric(15,5) , pct numeric(12,8) ); CREATE TABLE table2 ( id integer , fk_table1 integer , tpop char(2) , valor numeric(15,5) ); insert into table1 VALUES ( 1, 200 , 0 , 0

Re: [SQL] UPDATE in a specific order

2010-12-16 Thread Jasen Betts
> I need to make update of table1 with data on table2 in the order of id > of table2 that looks like EAV. is it? > I=B4m trying to do an update like this: that's not going to work. perhaps you can rewrite the from part to only return one row for every table1_fk, this one row will combine seve

[SQL] Create/update trigger auto-populate fields.

2010-12-16 Thread Chris Ruprecht
Hey guys, To start, I need to mention that I did read chapter 39-3 on triggers and do understand how they work, in the current (9.0) manuals (OK, maybe the manuals are RC1, but the content is the same as in 8.4... :). I have a simple table, person: pe_id | bigint | not n