|
|
Archives of the TeradataForum
Message Posted: Tue, 02 Aug 2005 @ 13:08:27 GMT
Subj: | | Re: Collect Stats in a Procedure |
|
From: | | Dieter Noeth |
Al MacGowan wrote:
| But Dieter, can you give us an example of a DELETE, an INSERT/SELECT, and a COLLECT STATISTICS statement all in one procedure? | |
| Better yet, what if you had to create a table, insert/select, and collect stats on it. | |
V2R5+
replace procedure dropme()
begin
create table x(i int);
insert into x
select day_of_calendar from sys_calendar.calendar;
collect statistics on x column i;
end;
call dropme();
sel count(*) from x;
drop table x;
If table x doesn't exist there's an error message:
SPL5000:W(L6), E(3807):Object 'x' does not exist.
IIRC this might be a problem in older releases, because the create SP will fail. Just create the table before create procedure (and then
drop it again) and it should work.
Dieter
| |