From: | Thiemo Kellner <thiemo(at)thiam(dot)ch> |
---|---|
To: | pgGeneral pgGeneral <pgsql-general(at)postgresql(dot)org>, pgNovice(at)thiam(dot)ch, pgNovice(at)thiam(dot)ch |
Subject: | Error >>syntax error<< at >>$1<< at character 53 |
Date: | 2004-08-07 23:18:19 |
Message-ID: | 200408080118.19799.thiemo@thiam.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
Hi,
I try to code a PL/pgSQL function, but always get to an execution error, I am
unable to solve:
sledger=# \i fnc_summary.pgsql
CREATE FUNCTION
COMMENT
GRANT
COMMIT
sledger=# select * from GET_SUMMARY();
ERROR: Error >>syntax error<< at >>$1<< at character 53
CONTEXT: PL/pgSQL function "get_summary" line 9 at for over select rows
The function script is as follows:
-- $Revision$
-- $Name$
-- $Date$
-- $Author$
-- $State$
-- $Locker$
-- $Source$
-- $Header$
-- Copyright (C) 2004 Thiemo Kellner
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- http://www.gnu.org/licenses/gpl.html
--\set SINGLESTEP
\unset SINGLESTEP
\set AUTOCOMMIT off
-- Objekte löschen
\unset ON_ERROR_STOP
--drop function GET_SUMMARY();
-- Objekte anlegen
\set ON_ERROR_STOP
create or replace function GET_SUMMARY() returns integer as '
declare
STR_SOURCE_NAME constant pg_catalog.pg_views.viewname%type
:= \'BUCHUNGEN\';
STR_OBJEKTVIEW constant pg_catalog.pg_views.viewname%type
:= \'OBJEKTHIERARCHIE\';
R_OBJEKTHIERARCHIE record;
TXT text;
begin
for R_OBJEKTHIERARCHIE in
select
OBJEKTKATEGORIE,
OBJEKTGRUPPE,
OBJEKT
from
STR_OBJEKTVIEW
loop
COMMON.LOG_INFO(\'Objektkategorie ist\' ||
R_OBJEKTHIERARCHIE.OBJEKTKATEGORIE)
;
end loop;
TXT := \'STR_SOURCE_NAME: \' || STR_SOURCE_NAME;
perform common.log_debug(TXT);
return 0;
end;
' language plpgsql;
comment on function GET_SUMMARY() is '
';
grant execute on function GET_SUMMARY() to public;
commit;
--\i include_a_file.pgsql
-- $Log$
Does somebody have an idea how to fix the function?
Cheers
Thiemo
--
root ist die Wurzel allen bels
Attachment | Content-Type | Size |
---|---|---|
fnc_summary_pgsql.DEFANGED-99 | application/defanged-99 | 2.0 KB |
sanitizer.log | text/sanitizer-log | 663 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Dino Nardini | 2004-08-08 00:23:45 | pg jdbc driver |
Previous Message | Scott Marlowe | 2004-08-07 21:43:18 | Re: Writing regex in PL's |
From | Date | Subject | |
---|---|---|---|
Next Message | A Gilmore | 2004-08-08 05:03:59 | Design question regarding arrays |
Previous Message | mike g | 2004-08-07 02:02:24 | Re: Newbie Instal Problem |