Re: [SQL] variable scooping

2006-01-29 Thread Michael Fuhr
On Mon, Jan 30, 2006 at 09:01:37AM +0700, ody quraviharto wrote: > "declare tbl_name varchar:='tbl_A'; > begin > if exists(select 1 from pg_tables where tablename=tbl_name) then > select count(*) from tbl_name; > end if; > end" > > the message was: syntax

[SQL] variable scooping

2006-01-29 Thread ody quraviharto
hi all, I'm a newbie in postgresql. I've tried to make function but having trouble in variable scooping. here is the code in plpgsql: "declare tbl_name varchar:='tbl_A'; begin if exists(select 1 from pg_tables where tablename=tbl_name) then select count(*) from tbl_