MySQL Forums
Forum List  »  Partitioning

Partition Linear Hast with function how expretion
Posted by: Eduardo Garcia
Date: July 14, 2006 02:28PM

Hi People

I want make a partition using a Lineas Hash, but i need use mu personal function how hash key, show my function and my create table and error

--- Function ---
CREATE FUNCTION Get_Client_Creative (creative INT) RETURNS INT
BEGIN
DECLARE client INT;
SELECT P.client_id into client FROM Creative Cr,Adgroup Ag,Campaign Ca,Product P where Cr.adgroup_id=Ag.adgroup_id and Ag.campaign_id=Ca.campaign_id and P.Product_id=Ca.Product_id and creative_id=creative;
RETURN client;
END
//
---- Table -----
DROP TABLE IF EXISTS `Sid`;
CREATE TABLE `Sid` (
`sid_id` int(11) NOT NULL auto_increment,
`sid` varchar(255) NOT NULL default '',
`keyword_id` int(11) NOT NULL default '0',
`creative_id` int(11) NOT NULL default '0',
`sid2` varchar(255) NOT NULL default '',
`max_bid_cpc` double(5,2) unsigned NOT NULL default '0.00',
`min_cpc` double(5,2) unsigned NOT NULL default '0.00',
`parent_id` int(11) NOT NULL default '0',
`bid_percentage` double(5,2) NOT NULL default '1.00',
`status` varchar(50) NOT NULL default 'active',
PRIMARY KEY (`sid_id`),
KEY `keyword_id` (`keyword_id`),
KEY `creative_id` (`creative_id`),
KEY `sid2` (`sid2`),
KEY `sid` (`sid`),
KEY `parent_id` (`parent_id`)
)
PARTITION BY HASH( Get_Client_Creative(`creative_id`) )
PARTITIONS 50;

--- Error ----

ERROR 1064 (42000): Constant/Random expression in (sub)partitioning function is not allowed near ')
---------------

The function run ok, when im run in select how:

mysql> select * from User where user_id=Get_Client_Creative (250);


any help please, thanks for your reponses

enzo

Options: ReplyQuote


Subject
Views
Written By
Posted
Partition Linear Hast with function how expretion
4548
July 14, 2006 02:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.