[SQL] interval +variable

2005-03-09 Thread Fatih Cerit
Dear all
Is there anyone at there who knows howto use dateadd in pgsql. I have a 
problem in my function that is like this ;

Select into futuredate now() + interval '30 days';  <- this is ok
but how can I use a variable intead of '30 days':(
Thanks 

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match


[SQL] plpgsql & date-time functions

2005-03-13 Thread Fatih Cerit
I have a function and I want to update a table's two rows but having problem 
with plpgsql & date-time functions. First field of the table must be now() 
this is ok.. but the second field must be now() + '60 days' if the query 
like this : SELECT INTO to_day now() + interval '60 days' ; it works but if 
I use variable instead of  '60 days' it doesn't work. And I must use 
variable

Thanks



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[SQL] substr or char_length problem

2005-06-17 Thread Fatih Cerit

Dear ALL

I have a problem with function substr or char_length or both. I guery A2 and 
it works fine. But sometimes gives 'ERROR:  negative substring length not 
allowed'. When I test many many times with diffrent values, never gives 
error. Sample table and query below.




A1  A2
---
1   1957
2   197
3   19
4
5   NULL
6   1
7   195


Select * from tbl_xxx where 
tbl_xxx.A2=substr('196895588454554545454',0,char_length(tbl_xxx.A2)+1);



Thanks
Fatih Cerit 



---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match