![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
hi, all I'm writting a procedure by pl/pgsql as following. It's a star-join query for star schema in data warehouse. The procedure is to test the performance of this kind of query. But I get an error at "perform select ...." statement. I can't find what is wrong with it ? Thank you to take time and trouble to lend me a hand. Jack -- Function: public.query() -- DROP FUNCTION public.query(); CREATE OR REPLACE FUNCTION public.query() RETURNS int4 AS ' DECLARE rand number; LineRow linelevel%ROWTYPE; RetailerRow retailerlevel%ROWTYPE; YearRow yearlevel%ROWTYPE; MonthRow monthlevel%ROWTYPE; QuarterRow quarterlevel%ROWTYPE; starttime timestamp; duration timestamp; BEGIN rand := random(); select * into LineRow from linelevel limit 1 offset floor(rand*15); rand := random(); select * into RetailerRow from retailerlevel limit 1 offset floor(rand*99); rand := random(); select * into YearRow from yearlevel limit 1 offset floor(rand*2); rand := random(); select * into MonthRow from monthlevel limit 1 offset floor(rand*24); rand := random(); select * into QuarterRow from quarterlevel limit 1 offset floor(rand*8); starttime := \'now\'; perform select * FROM custlevel as c, actvars as f, prodlevel as p, timelevel as t where c.store_level = f.customer_level AND p.code_level = f.product_level AND t.month_level = f.time_level AND P.line_level = LineRow.level AND t.year_level = YearRow.level AND c.retailer_level = RetailerRow.level; duration := \'now\'-starttime; END; ' LANGUAGE 'plpgsql' VOLATILE; |
![]() |
| Thread Tools | |
| Display Modes | |
| |