2016-05-24 5 views
1

存在しませxxxxは、私は、MySQLへの新たなんだと私は新しいサーバーに古いサイトからデータベースをインポートしようとしているが、私は次のエラーを取得しておいてください。#1305 - FUNCTIONは

#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`)) 
); 

ご協力いただければ幸いです。

答えて

1

CREATE VIEWステートメントは、前の行で削除したsp_get_user_balance関数を使用します。

CREATE FUNCTIONステートメントが再作成されていません。

SHOW CREATE FUNCTION sp_get_user_balanceを使用して古いサイトからエクスポートできます。

また、インポートファイルの後にある場合は、文を並べ替えて、transactions_detailビュー定義の前に来るようにすることができます。

関連する問題