2016-04-29 10 views
0

ストアドプロシージャの実行中に問題が発生しています。私はこのクエリを実行することができますMySqlストアドプロシージャ - フィールドリストの不明な列

select 
bit_count(cast(conv(substr('00d803fc07fc1ff807f8027f203f607b01fe03ff01fc03b8077f07780fb94039', 1, 16), 16, 10) as unsigned)^cast(conv(substr('00d803fc07fc1ff807f8027f203f607b00fe03ff01fe03b8077f07780fb94039', 1, 16), 16, 10) as unsigned)) + 
bit_count(cast(conv(substr('00d803fc07fc1ff807f8027f203f607b01fe03ff01fc03b8077f07780fb94039', 17, 16), 16, 10) as unsigned)^cast(conv(substr('00d803fc07fc1ff807f8027f203f607b00fe03ff01fe03b8077f07780fb94039', 17, 16), 16, 10) as unsigned)) + 
bit_count(cast(conv(substr('00d803fc07fc1ff807f8027f203f607b01fe03ff01fc03b8077f07780fb94039', 33, 16), 16, 10) as unsigned)^cast(conv(substr('00d803fc07fc1ff807f8027f203f607b00fe03ff01fe03b8077f07780fb94039', 33, 16), 16, 10) as unsigned)) + 
bit_count(cast(conv(substr('00d803fc07fc1ff807f8027f203f607b01fe03ff01fc03b8077f07780fb94039', 49, 16), 16, 10) as unsigned)^cast(conv(substr('00d803fc07fc1ff807f8027f203f607b00fe03ff01fe03b8077f07780fb94039', 49, 16), 16, 10) as unsigned)); 

しかし、私は、ストアドプロシージャにこれを作るしようとすると、それは「不明な列」のエラーで失敗します。

MariaDB [modscripts]> DELIMITER // 
MariaDB [modscripts]> CREATE PROCEDURE Distance(IN fp1 CHAR(64), fp2 CHAR(64)) 
-> BEGIN 
-> SELECT bit_count(cast(conv(substr(fp1, 1, 16), 16, 10) as unsigned)^cast(conv(substr(fp2, 1, 16), 16, 10) as unsigned)) + 
-> bit_count(cast(conv(substr(fp1, 17, 16), 16, 10) as unsigned)^cast(conv(substr(fp2, 17, 16), 16, 10) as unsigned)) + 
-> bit_count(cast(conv(substr(fp1, 33, 16), 16, 10) as unsigned)^cast(conv(substr(fp2, 33, 16), 16, 10) as unsigned)) + 
-> bit_count(cast(conv(substr(fp1, 49, 16), 16, 10) as unsigned)^cast(conv(substr(fp2, 49, 16), 16, 10) as unsigned)); 
-> END // 
Query OK, 0 rows affected (0.00 sec) 

MariaDB [modscripts]> DELIMITER ; 
MariaDB [modscripts]> call Distance(00d803fc07fc1ff807f8027f203f607b01fe03ff01fc03b8077f07780fb94039, 00d803fc07fc1ff807f8027f203f607b00fe03ff01fe03b8077f07780fb94039); 
ERROR 1054 (42S22): Unknown column '00d803fc07fc1ff807f8027f203f607b01fe03ff01fc03b8077f07780fb94039' in 'field list' 

は私が間違って何をしているのですか?私は、同じ結果を持つselect文でfp1とfp2( 'fp1')を一重引用符で囲みてみました。

ありがとうございます!

答えて

0

私はそれを理解しました。 CALL文には一重引用符が必要でした。 ARGH!

call Distance('00d803fc07fc1ff807f8027f203f607b01fe03ff01fc03b8077f07780fb94039','00d803fc07fc1ff807f8027f203f607b01fe03ff01fc03b8077f07780fb94039'); 
関連する問題