Function compile error - Mailing list pgsql-sql

From Sivannarayanreddy
Subject Function compile error
Date
Msg-id 4D5BC495.5000605@subexworld.com
Whole thread Raw
Responses Re: Function compile error  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Function compile error  ("Igor Neyman" <ineyman@perceptron.com>)
List pgsql-sql
<tt>Hello,<br /> 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<br /><br /> CREATE FUNCTION check_password(databasename text, tablename text,
indexnametext)RETURNS VOID AS <br /> DECLARE v_count INTEGER;<br /> BEGIN<br />   select  count(1) into v_count  from 
pg_indexinx where  inx.indexrelid in<br />  (select oid from pg_class where relname=$3 and relowner in <br />  (select
oidfrom pg_authid where rolname=$1)) <br />  and inx.indrelid in <br />  (select oid from pg_class where relname=$2 and
relownerin <br />  (select oid from pg_authid where rolname=$1)); <br />  if v_count = 0 then  <br /> execute immediate
'createunique index $3 on $2 (acn_id)';  <br /> end if; <br /> END;</tt><br /><div class="moz-signature"><br /></div><p
style="margin-bottom:0in;"><strong><font color="#939598"><font face="Arial"><font size="2">Sivannarayanareddy
Nusum</font></font></font></strong><strong><fontcolor="#000080"> </font></strong><strong><font color="#000080"><font
face="Arial"><fontsize="2">| </font></font></font></strong><strong><font color="#0000ff"><font face="Arial"><font
size="2">SystemAnalyst(Moneta GDO)</font></font></font></strong><font color="#000080"> </font><p style="margin-bottom:
0in;"><fontface="Arial"><font size="1" style="font-size: 8pt;"><img align="BOTTOM" border="0" height="71"
name="graphics1"src="cid:part1.04020508.04040903@subexworld.com" width="190" /></font></font><p style="margin-bottom:
0in;"><fontcolor="#808080"><font face="Arial"><font size="1" style="font-size: 8pt;">Subex Limited, Adarsh Tech Park,
OuterRing Road, Devarabisannalli, Bangalore – 560037, India.<br /></font></font></font><font color="#a01e55"><font
face="Arial"><fontsize="1" style="font-size: 8pt;"><b>Phone:</b></font></font></font><font color="#000000">
</font><fontcolor="#000000"><font face="Arial"><font size="1" style="font-size: 8pt;">+91 80 6696 3371;
</font></font></font><fontcolor="#a01e55"><font face="Arial"><font size="1" style="font-size:
8pt;"><b>Mobile:</b></font></font></font><fontcolor="#000000"> </font><font color="#000000"><font face="Arial"><font
size="1"style="font-size: 8pt;">+91 9902065831</font></font></font><font color="#c1272d">  </font><font
color="#a01e55"><fontface="Arial"><font size="1" style="font-size:
8pt;"><b>Fax:</b></font></font></font><fontcolor="#000000"> </font><font color="#000000"><font face="Arial"><font
size="1"style="font-size: 8pt;">+91 80 6696 3333; </font></font></font><p style="margin-bottom: 0in;"><font
color="#a01e55"><fontface="Arial"><font size="1" style="font-size: 8pt;"><b>Email:</b></font></font></font><font
color="#c1272d"> </font><font color="#c1272d"><font face="Arial"><font size="1" style="font-size: 8pt;"><a
href="mailto:email.id@subexworld.com">sivannarayanreddy@subexworld.com</a>;</font></font></font><font
color="#a01e55"><fontface="Arial"><font size="1" style="font-size: 8pt;"><b>URL:</b></font></font></font><font
color="#c1272d"> </font><a href="http://www.subexworld.com/"><font color="#c1272d"><font face="Arial"><font size="1"
style="font-size:              8pt;">www.subexworld.com</font></font></font></a><font color="#c1272d"> </font><p
style="margin-bottom:0in;"><font color="#c1272d"> </font><p class="msonormal"><font color="#808080"><font
face="Arial"><fontsize="1" style="font-size: 8pt;"><i>Disclaimer: This e-mail is bound by the terms and conditions
describedat </i></font></font></font><a href="http://www.subexworld.com/mail-disclaimer.html"><font face="Arial"><font
size="1"style="font-size: 8pt;"><i>http://www.subexworld.com/mail-disclaimer.html</i></font></font></a><font
color="#808080"><br/></font> 

pgsql-sql by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Oracle Equivalent queries in Postgres
Next
From: Pavel Stehule
Date:
Subject: Re: Function compile error