Re: Function error

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Function error
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B537BADFA@ntex2010a.host.magwien.gv.at
обсуждение исходный текст
Ответ на Function error  (Sachin Srivastava <ssr.teleatlas@gmail.com>)
Список pgsql-general
Sachin Srivastava wrote:
> I am getting the below error for function, please see the bold line in "Function code", please suggest
> what I will do to correct this code.
> 
>  -----------------------
> 
> ERROR:  syntax error at or near "*"
> LINE 35: SELECT * from logError(msg text) is
>                 ^
> CONTEXT:  invalid type name "* from logError(msg text) is

That error message does not look like it could come from the
function definition below, but the function definition is clearly
syntactically incorrect:

> CREATE OR REPLACE FUNCTION cp_property_room_count_trans(
>     subscriberid bigint,
>     incompanyid bigint,
>     loginname text)
>   RETURNS void AS
> $BODY$
> DECLARE

[...]

>   SELECT logError(v_errorMesg text, procedureName text, subscriberID bigint, companyID bigint,
> supplierSku text, loginName text) is
> 
> BEGIN
>      insert into SMERROR_LOG
>      (error_message, method_name, system_message, error_log_id, subscriber_id, company_id,
> creation_date, creation_user, update_date, update_user)
>      values(v_errorMesg, procedureName, supplierSku, nextval('smerror_log_sequence'), subscriberID,
> companyID, LOCALTIMESTAMP, loginName, LOCALTIMESTAMP, 'V7Admin');
>   end;

You cannot declare a function inside the DECLARE section of
another function.  Besides, what is "SELECT logError" supposed to mean?

You will have to declare each of the helper functions with ist own
CREATE FUNCTION statement.

Yours,
Laurenz Albe

В списке pgsql-general по дате отправления:

Предыдущее
От: Geoff Winkless
Дата:
Сообщение: Re: WIP: CoC V5
Следующее
От: Christian Ramseyer
Дата:
Сообщение: Changing varchar length by manipulating pg_attribute