sql >> データベース >  >> RDS >> Mysql

'where句'の不明な列'x'

    SQLコードでエラーが発生する可能性があることを指摘しましたが、詳細を説明したいと思います。

    That Stored Procedure Runing at MySql WithOut any problems but when send Delphi parameters to sp , i get that Error !! しかし、あなたは間違っています。

    a known bugがあります プロシージャの作成で。 ランタイム例外が発生した理由により 。
    Semantics of Stored procedure code is not checked at CREATE time. At runtime, undeclared variables are detected, and an error message is generated for each reference to an undeclared variable. However, SP's seem to believe any reference denotes a column, even though the syntactic context excludes that. This leads to a very confusing error message in case the procedure.

    標準的なテスト例は次のとおりです。

    mysql> drop procedure proc_test;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> delimiter //
    mysql> CREATE PROCEDURE proc_test()
        -> BEGIN
        ->     select current_day;
        -> END
        -> //
    Query OK, 0 rows affected (0.00 sec)
    

    ここで、プロシージャのコンパイルがcurrent dayで無視されたことを理解できます。 です。

    mysql> delimiter ;
    mysql> call proc_test();
    ERROR 1054 (42S22): Unknown column 'current_day' in 'field list'
    mysql>
    

    これにより、That Stored Procedure Runing at MySql WithOut any problems ... 正しくありません。

    クエリをすばやく修正すると、問題が解決します。 I defined input parameters with _ prefix. I don't know waht i must do ! 。それが本当なら、
    変更

    SELECT * FROM bimar WHERE `_code_ehda_konandeh` = `code_ehda_konandeh`
    

    SELECT * FROM bimar WHERE `code_ehda_konandeh` = _code_ehda_konandeh
    

    そしてそれは機能しているはずです。ここでは、code_ehda_konandehを想定しています。 テーブルbimarの列です



    1. Hibernate を使用した Oracle 関数

    2. GUIDのSCOPE_IDENTITY()?

    3. 各クエリの前にmysqlサーバーにpingを実行する必要がありますか?

    4. MySQLカウント頻度