error on line 1 trying to execute a script using psql

From: Steven Dahlin <pgdb(dot)sldahlin(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: error on line 1 trying to execute a script using psql
Date: 2010-06-20 21:53:40
Message-ID: AANLkTikpLjmRR79VVEMH49RZTHzgEJcS-6sclTSmYP4O@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I am attempting to generate a temporary function to execute some dml with
the following script:

create or replace function setuplicense() returns integer as $$
declare
hwcustid integer := 0;
retval integer := 0;
begin
insert into license.customer
( customer_id ) values ( hwcustid );
commit;
return retval;
end;
$$
LANGUAGE plpgsql;

select setuplicense();

When running this with psql I get the following:

Error: syntax error at or near "create"

Does anyone have a suggestion as to what is causing this?

Thanks

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kenneth Marshall 2010-06-21 18:52:06 Re: running scripts like oracle sqlplus
Previous Message Steven Dahlin 2010-06-18 22:24:18 running scripts like oracle sqlplus