SQL Script

From: "Kevin Willems" <kdwillems(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: SQL Script
Date: 2001-03-30 18:50:15
Message-ID: Hz4x6.1028$Tfq.8978590@tomcat.sk.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

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;'

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-03-30 18:52:42 Re: Memory Tuning
Previous Message Mitch Vincent 2001-03-30 18:46:45 Re: Globally Unique IDs?