1
我新的MySQL和我試圖從舊站點導入一個數據庫到一個新的服務器,但我不斷收到以下錯誤:#1305 - 功能XXXX不存在
#1305 - FUNCTION data_mysql.sp_get_user_balance does not exist
這裏我正在使用的SQL:
DELIMITER $$
--
-- Functions
--
DROP FUNCTION IF EXISTS `sp_get_user_balance`$$
$$
DROP FUNCTION IF EXISTS `sp_get_user_balance_sys`$$
$$
DELIMITER ;
CREATE VIEW `transactions_detail` AS
select `tx`.`id` AS `id`
, `tx`.`transaction_id` AS `transaction_id`
,date_format(`tx`.`tdate`,'%Y/%m/%d') AS `tdate`
,date_format(`tx`.`tdate`,'%T') AS `ttime`
,`tx`.`tdate` AS `tdatetime`
,`tx`.`sender_id` AS `sender_id`
,if((`t`.`transaction_type` = 'Withdrawal'),`sp_get_user_balance`(`tx`.`sender_id`),0) AS `sender_balance`
,`tx`.`receiver_id` AS `receiver_id`
,`st`.`username` AS `sender_name`
,`rt`.`username` AS `receiver_name`
,`tx`.`invoice_number` AS `invoice_number`
,`p`.`name` AS `product_name`
,`p`.`price` AS `product_price`
,cast(if(isnull(`tx`.`sender_id`),`tx`.`amount`,-(`tx`.`amount`)) as decimal(11,2)) AS `oamount`
,cast(`tx`.`amount` as decimal(11,2)) AS `amount`
,cast(if((`tx`.`receiver_id` is not null)
,(`tx`.`amount` - `tx`.`fees`),0) as decimal(11,2)) AS `nets`
,cast(`tx`.`fees` as decimal(11,2)) AS `fees`
,`s`.`transaction_status` AS `status`
,`t`.`transaction_type` AS `type`
,ifnull(`tx`.`comments`,'--') AS `comments`
,`tx`.`can_view` AS `can_view`
,`tx`.`can_refund` AS `can_refund`
,`tx`.`cc_email` AS `cc_email`
,`tx`.`cc_name` AS `cc_name`
from (((((`t_transactions` `tx`
join `s_transaction_type` `t` on((`tx`.`transaction_type_id` = `t`.`id`)))
join `s_transaction_status` `s` on((`tx`.`transaction_status_id` = `s`.`id`)))
left join `t_products` `p` on((`tx`.`product_id` = `p`.`id`)))
left join `t_members` `st` on((`tx`.`sender_id` = `st`.`id`)))
left join `t_members` `rt` on((`tx`.`receiver_id` = `rt`.`id`))
);
任何幫助將不勝感激。