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
fnc_summary_pgsql.DEFANGED-99
Description: application/defanged-99
This message has been 'sanitized'. This means that potentially dangerous content has been rewritten or removed. The following log describes which actions were taken. Sanitizer (start="0"): Part (pos="910"): SanitizeFile (filename="unnamed.txt", mimetype="text/plain"): Match (names="unnamed.txt", rule="3"): Enforced policy: accept Part (pos="3736"): SanitizeFile (filename="fnc_summary.pgsql", mimetype="text/plain"): Match (rule="default"): Enforced policy: defang Replaced mime type with: application/DEFANGED-99 Replaced file name with: fnc_summary_pgsql.DEFANGED-99 Total modifications so far: 1
---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]