examples with execute

Поиск
Список
Период
Сортировка
От Johnson, Shaunn
Тема examples with execute
Дата
Msg-id 73309C2FDD95D11192E60008C7B1D5BB04C73ACB@snt452.corp.bcbsm.com
обсуждение исходный текст
Список pgsql-general

Howdy:

Running Postgres 7.1.3 on RedHat Linux.

Can someone give me an example of
using the EXECUTE command while
in a function?  For example, I'd like to
create a table using EXECUTE, but I'm
not sure about it's use (or how to use
create in a function).

My goal is to do something like this:

[snip code]

drop function t_member_cnt(int);
create function t_member_cnt(int)
returns integer
as '
declare nCnt int4;

begin
        select count (*) from test_table into nCnt;
        if nCnt < 1500000 then
        return nCnt;
        else
        execute drop test_table;
        execute select * into test_table from standby_table
                where user_id=''3924'';
        end if;
        return nCnt;
end; '
language 'plpgsql';

-- change to user and execute the function
--
\c database joeuser
select t_member_cnt(0);

-- do the permissions part
--
grant select on test_table to public
drop index test_i;
create index test_i;

[/snip code]   

Perhaps I've missed it, but I haven't see much in the
way of 'real world examples' using execute.

Suggestions welcomed!

Thanks!

-X

В списке pgsql-general по дате отправления:

Предыдущее
От: Randall Perry
Дата:
Сообщение: Re: Serious environment problem with 7.2 on Solaris
Следующее
От: "Olonichev Sergei"
Дата:
Сообщение: How to add big amounts of data into database?