Re: SQL Script

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: SQL Script
Дата
Msg-id Pine.LNX.4.30.0104011246120.1308-100000@peter.localdomain
обсуждение исходный текст
Ответ на SQL Script  ("Kevin Willems" <kdwillems@hotmail.com>)
Список pgsql-general
Kevin Willems writes:

> I have written the following function but when I try to run it, I get Error:
> ERROR:  parser: parse error at or near "". As you can see, there is no
> instance of "" in my function. Does anyone have any idea why this is
> happening?

"" means 'empty string', which often indicates end of input.

>
> CREATE FUNCTION dropifexists(text)
> RETURNS text
> AS 'DECLARE
>    numcount integer;
>    nameoftable text;
> BEGIN
>    nameoftable := lower($1);
>    SELECT INTO numcount count(tablename)
>    FROM pg_tables
>    WHERE tablename = nameoftable;
>
>    if numcount = 1
>    then DROP TABLE nameoftable;
>    end if;
>    RETURN nameoftable;
> END;'

You're missing LANGUAGE '...' here.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Need PostgreSQL startup scripts
Следующее
От:
Дата:
Сообщение: ...