From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Derrick Betts <Derrick(at)Blue-Axis(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Extract Function |
Date: | 2004-03-26 20:18:20 |
Message-ID: | 20040326201820.GA20194@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Fri, Mar 19, 2004 at 07:44:25 -0700,
Derrick Betts <Derrick(at)Blue-Axis(dot)com> wrote:
> I am trying to use the EXTRACT function in pl/pgsql and running into a problem.
>
> This is the command:
>
> SELECT EXTRACT(EPOCH FROM TIMESTAMP variable_name) INTO Temp;
>
> The variable_name is of type text (I've also tried it as type timestamp), but the parser breaks when it attempts to perform this function. It works great when I substitute the variable_name with '2004-1-10 00:00:00' , however, when I use a variable, it doesn't.
>
> Any one have any ideas on how I can get variable substitution to work in my function using EXTRACT?
I don't think typename variable is a valid operation. You would need to use
CAST or :: to do a typecast. Probably you should just leave out "TIMESTAMP"
from your example.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2004-03-26 20:26:47 | Re: How do you do a negative join? |
Previous Message | Stephan Szabo | 2004-03-26 19:40:02 | Re: how to test string against regular expression contained |