From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Get interval in months |
Date: | 2008-11-10 05:47:25 |
Message-ID: | 20081110054725.GA18195@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
am Mon, dem 10.11.2008, um 12:06:04 +0700 mailte dbalinglung folgendes:
> Dear Expert,
First, please create a new thread for a new question.
>
> I have a function to getting time interval bellow :
>
> create or replace function scmaster.pr_gettimeinterval(time without time zone,
> time without time zone, numeric(5,2)) returns char(10) As '
> declare v_timein alias for $1;
> v_timeout alias for $2;
> v_timebreak alias for $3;
> v_output char(10);
> begin
> raise notice ''-- BOF --'';
> v_output := select ((v_timeout - v_timein) - interval ''v_timebreak
> minutes'');
>
> raise notice ''-- EOF --'';
> return v_output;
> end;'
> language plpgsql;
>
>
> and when i compilled from pgAdmin, i got some error message bellow :
>
> ERROR: syntax error at or near "select"
> LINE 1: SELECT select (( $1 - $2 ) - interval 'v_timebreak minute...
> ^
> QUERY: SELECT select (( $1 - $2 ) - interval 'v_timebreak minutes')
> CONTEXT: SQL statement in PL/PgSQL function "pr_gettimeinterval" near line 7
>
> ********** Error **********
Rewrite the line
v_output := select ((v_timeout - v_timein) ...
to:
select into v_output ((v_timeout - v_timein) ...
(not tested)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
From | Date | Subject | |
---|---|---|---|
Next Message | dbalinglung | 2008-11-10 06:13:05 | Put variable values on time interval (from : Re: Get interval in months) |
Previous Message | Michael Black | 2008-11-10 05:36:41 | Re: Chart of Accounts |