pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PL/SQL block error
2+ messages / 2 participants
[nested] [flat]

* PL/SQL block error
@ 2011-02-16 08:42 Sivannarayanreddy <sivannarayanreddy@subexworld.com>
  2011-02-16 09:07 ` Re: PL/SQL block error Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Sivannarayanreddy @ 2011-02-16 08:42 UTC (permalink / raw)
  To: pgsql-sql

Hello,
I am very new to the postgres sql, i am trying to execute below pl/sql 
block in postgres but i am getting error *'ERROR:  syntax error at or 
near "integer" '*, Could some one help me in this regard

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='action_pk' and relowner in
  (select oid from pg_authid where rolname='postgres_ref'))
  and inx.indrelid in
  (select oid from pg_class where relname='action' and relowner in
  (select oid from pg_authid where rolname='postgres_ref'));

if v_count = 0 then
execute immediate 'create unique index action_pk
on action(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, ../../4D5B8E0E.5040101@subexworld.com/3-graphics1)
  download | view image

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PL/SQL block error
  2011-02-16 08:42 PL/SQL block error Sivannarayanreddy <sivannarayanreddy@subexworld.com>
@ 2011-02-16 09:07 ` Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Pavel Stehule @ 2011-02-16 09:07 UTC (permalink / raw)
  To: sivannarayanreddy@subexworld.com; +Cc: pgsql-sql

Hello

you should to wrap code to function or inline function everywhere.

psql doesn't support PL/SQL and doesn't support inlined PL/SQL blocks.

Regards

Pavel Stehule

2011/2/16 Sivannarayanreddy <sivannarayanreddy@subexworld.com>

>  Hello,
> I am very new to the postgres sql, i am trying to execute below pl/sql
> block in postgres but i am getting error *'ERROR:  syntax error at or near
> "integer" '*, Could some one help me in this regard
>
> 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='action_pk' and relowner in
>  (select oid from pg_authid where rolname='postgres_ref'))
>  and inx.indrelid in
>  (select oid from pg_class where relname='action' and relowner in
>  (select oid from pg_authid where rolname='postgres_ref'));
>
> if v_count = 0 then
> execute immediate 'create unique index action_pk
> on action(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 <email.id@subexworld.com>; *
> URL:*  www.subexworld.com
>
>
>
> *Disclaimer: This e-mail is bound by the terms and conditions described at
> **http://www.subexworld.com/mail-disclaimer.html*<http://www.subexworld.com/mail-disclaimer.html;
>

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-02-16 09:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-16 08:42 PL/SQL block error Sivannarayanreddy <sivannarayanreddy@subexworld.com>
2011-02-16 09:07 ` Pavel Stehule <pavel.stehule@gmail.com>

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