pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sivannarayanreddy <sivannarayanreddy@subexworld.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Function compile error
Date: Wed, 16 Feb 2011 18:05:33 +0530
Message-ID: <4D5BC495.5000605@subexworld.com> (raw)

Hello,
I am trying to create the function as below but it is throwing error 
'ERROR:  syntax error at or near "DECLARE"', Could some one help me please

CREATE FUNCTION check_password(databasename text, tablename text, 
indexname text)RETURNS VOID AS
DECLARE v_count INTEGER;
BEGIN
   select  count(1) into v_count  from  pg_index inx where  
inx.indexrelid in
  (select oid from pg_class where relname=$3 and relowner in
  (select oid from pg_authid where rolname=$1))
  and inx.indrelid in
  (select oid from pg_class where relname=$2 and relowner in
  (select oid from pg_authid where rolname=$1));
  if v_count = 0 then
execute immediate 'create unique index $3 on $2 (acn_id)';
end if;
END;

*Sivannarayanareddy Nusum****| **System Analyst(Moneta GDO)*

Subex Limited, Adarsh Tech Park, Outer Ring Road, Devarabisannalli, 
Bangalore -- 560037, India.
*Phone:*+91 80 6696 3371; *Mobile:*+91 9902065831*Fax:*+91 80 6696 3333;

*Email:*sivannarayanreddy@subexworld.com 
<mailto:email.id@subexworld.com>; *URL:*www.subexworld.com 
<http://www.subexworld.com/;

/Disclaimer: This e-mail is bound by the terms and conditions described 
at //http://www.subexworld.com/mail-disclaimer.html/

Attachments:

  [image/gif] graphics1 (5.5K, ../4D5BC495.5000605@subexworld.com/3-graphics1)
  download | view image

view thread (4+ messages)  latest in thread

Message-ID: <4D5BC495.5000605@subexworld.com>
Permalink:  ../4D5BC495.5000605@subexworld.com/
Also on:    postgresql.org/message-id/4D5BC495.5000605@subexworld.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sivannarayanreddy@subexworld.com
  Subject: Re: Function compile error
  In-Reply-To: <4D5BC495.5000605@subexworld.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox