Re: [GENERAL] replacing expresion in plpgsql

2013-12-16 Thread Merlin Moncure
On Mon, Dec 16, 2013 at 2:08 AM, John R Pierce wrote: > On 12/15/2013 10:54 PM, Thomas Kellerer wrote: >> >> Both are valid. interval '2' day is the ANSI SQL format though. > > > oh, really! ah, I stand corrected, didn't realize the units were valid > keywords like that. Me neither. Stuff lik

Re: [GENERAL] replacing expresion in plpgsql

2013-12-16 Thread John R Pierce
On 12/15/2013 10:54 PM, Thomas Kellerer wrote: Both are valid. interval '2' day is the ANSI SQL format though. oh, really! ah, I stand corrected, didn't realize the units were valid keywords like that. -- john r pierce 37N 122W somewhere on the middle

Re: [GENERAL] replacing expresion in plpgsql

2013-12-15 Thread Thomas Kellerer
John R Pierce, 16.12.2013 01:23: >> select current_timestamp, current_timestamp + interval '2' day; > > that should be interval '2 day' (note the ' moved), and for a variable > number passed as a parameter, try... Both are valid. interval '2' day is the ANSI SQL format though. -- Se

Re: [GENERAL] replacing expresion in plpgsql

2013-12-15 Thread Juan Pablo L
thank you very much for clarifying . On 15 December 2013 19:02, Andreas Brandl wrote: > John, > > - Ursprüngliche Mail - > > On 12/15/2013 4:17 PM, Andreas Brandl wrote: > > > select current_timestamp, current_timestamp + interval '2' day; > > > > that should be interval '2 day' (

Re: [GENERAL] replacing expresion in plpgsql

2013-12-15 Thread Andreas Brandl
John, - Ursprüngliche Mail - > On 12/15/2013 4:17 PM, Andreas Brandl wrote: > > select current_timestamp, current_timestamp + interval '2' day; > > that should be interval '2 day' (note the ' moved), and for a > variable number passed as a parameter, try... # select current_timestamp +

Re: [GENERAL] replacing expresion in plpgsql

2013-12-15 Thread Juan Pablo L
Hi, thank you very much, this worked flawlessly, this is the final code: execute 'select CURRENT_TIMESTAMP + $1 * interval ''1 day''' into newexpdate using expdays; works perfect, thanks a ton! On 15 December 2013 18:23, John R Pierce wrote: > On 12/15/2013 4:17 PM, Andreas Brandl wrote: > >>

Re: [GENERAL] replacing expresion in plpgsql

2013-12-15 Thread Juan Pablo L
Hi i m working with timestamp cause i need the time too. i tried your solution and it works perfectly, it just does not adjust to my problem. thanks a lot for the answer. On 15 December 2013 18:17, Andreas Brandl wrote: > Hi, > > - Ursprüngliche Mail - > > > > Hi, i have a function that

Re: [GENERAL] replacing expresion in plpgsql

2013-12-15 Thread John R Pierce
On 12/15/2013 4:17 PM, Andreas Brandl wrote: select current_timestamp, current_timestamp + interval '2' day; that should be interval '2 day' (note the ' moved), and for a variable number passed as a parameter, try... select current_timestamp, current_timestamp + $1 * interval '1 day';

Re: [GENERAL] replacing expresion in plpgsql

2013-12-15 Thread Andreas Brandl
Hi, - Ursprüngliche Mail - > > Hi, i have a function that receives a parameter which represents > days: > > > FUNCTION aaa_recharge_account(expdays integer) > > > i want to add those days to the CURRENT_DATE, but i do not know how > to do it, i have tried several ways to replace that in an

[GENERAL] replacing expresion in plpgsql

2013-12-15 Thread Juan Pablo L
Hi, i have a function that receives a parameter which represents days: FUNCTION aaa_recharge_account(expdays integer) i want to add those days to the CURRENT_DATE, but i do not know how to do it, i have tried several ways to replace that in an expresion like: newexpdate := CURRENT_TIMESTAMP + in