[Seasar-user:15913] Re: 外だしSQL&sql2entity.bat

kubo [E-MAIL ADDRESS DELETED]
2008年 10月 6日 (月) 19:18:51 JST


久保(jflute)です。

ご報告ありがとうございます。

エラー内容が変わって、
「Selectと認識されて別の文法エラーが発生」
したかもしれません。
(ちょと想像でしかないですが。。。)

該当SQLは文法的なエラーはありませんでしょうか?

> -104, SQLSTATE: 42601, SQLERRMC: /*IF pmb.isPaging()*/;AME
> FROM NSM_VENDER

の「/*IF pmb.isPaging()*/;AME」が変な感じなので、
ご確認下さい。


#
# しかし、先頭文字がコメントでも
# dbflute-db2-exampleではうまくいってますね。。。
#

2008/10/6 陳捷 <[E-MAIL ADDRESS DELETED]>:
> 陳捷です。
>
> ご返事ありがとうございました。
>
>> さらにですが、先頭の「/*IF pmb.isPaging()*/」を
>> 削除してSql2Entityやって頂けますでしょうか?
>
> if 文のみですか?もしくは
>
> /*IF pmb.isPaging()*/      ← 削除
> SELECT  DISTINCT
>       MASTER_VENDER.OWNER_CODE,
>       MASTER_VENDER.SUPPLIER_CODE,
>       MASTER_SUPPLIER.SUPPLIER_NAME,
>       MASTER_VENDER.VENDER_CODE,
>       MASTER_VENDER.VENDER_NAME
> -- ELSE select count(*)      ← 削除
> /*END*/     ← 削除
> FROM MASTER_VENDER
>
> もし、上記の三箇所を削除して、もう一度実行すれば、下記のエラーが出てきました。
> -------------------------------------------------------------------------------
>        at org.seasar.dbflute.task.DfSql2EntityTask$2.execSQL(DfSql2EntityTask.java:303)
>        at org.seasar.dbflute.helper.jdbc.sqlfile.DfSqlFileRunnerBase.runTransaction(DfSqlFileRunnerBase.java:90)
>        at org.seasar.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan.execute(DfSqlFileFireMan.java:34)
>        at org.seasar.dbflute.task.DfSql2EntityTask.doExecute(DfSql2EntityTask.java:129)
>        at org.seasar.dbflute.task.bs.DfAbstractTexenTask.execute(DfAbstractTexenTask.java:107)
>        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>        at org.apache.tools.ant.Task.perform(Task.java:364)
>        at org.apache.tools.ant.Target.execute(Target.java:341)
>        at org.apache.tools.ant.Target.performTasks(Target.java:369)
>        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
>        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
>        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>        at org.apache.tools.ant.Main.runBuild(Main.java:668)
>        at org.apache.tools.ant.Main.startAnt(Main.java:187)
>        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
>        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
> Caused by: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE:
> -104, SQLSTATE: 42601, SQLERRMC: /*IF pmb.isPaging()*/;AME
> FROM NSM_VENDER
> ;<space>
>        at com.ibm.db2.jcc.b.zc.e(zc.java:1606)
>        at com.ibm.db2.jcc.b.zc.a(zc.java:1206)
>        at com.ibm.db2.jcc.a.db.h(db.java:149)
>        at com.ibm.db2.jcc.a.db.a(db.java:43)
>        at com.ibm.db2.jcc.a.r.a(r.java:30)
>        at com.ibm.db2.jcc.a.sb.g(sb.java:152)
>        at com.ibm.db2.jcc.b.zc.n(zc.java:1186)
>        at com.ibm.db2.jcc.b.zc.a(zc.java:1857)
>        at com.ibm.db2.jcc.b.zc.a(zc.java:497)
>        at com.ibm.db2.jcc.b.zc.executeQuery(zc.java:481)
>        at org.seasar.dbflute.task.DfSql2EntityTask$2.execSQL(DfSql2EntityTask.java:219)
>        ... 16 more
> 2008-10-06 18:58:21,500 [main] INFO
> (DfAbstractTexenTask#execute():116) -
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
> 2008-10-06 18:58:21,515 [main] INFO
> (DfAbstractTexenTask#execute():117) - [Task End: 00m02s735ms]
> 2008-10-06 18:58:21,515 [main] INFO
> (DfAbstractTexenTask#execute():118) - _/_/_/_/_/
> ----------------------------------------------------------------------------
>
> ご返事をお待ちしております。よろしくお願いいたします。
>
>
> 2008/10/06 18:51 kubo <[E-MAIL ADDRESS DELETED]>:
>> 久保(jflute)です。
>>
>> ご報告ありがとうございます。
>>
>>> /*IF pmb.isPaging()*/
>>> SELECT  DISTINCT
>>>        MASTER_VENDER.OWNER_CODE,
>>>        MASTER_VENDER.SUPPLIER_CODE,
>>>        MASTER_SUPPLIER.SUPPLIER_NAME,
>>
>> さらにですが、先頭の「/*IF pmb.isPaging()*/」を
>> 削除してSql2Entityやって頂けますでしょうか?
>> (先頭の文字がSELECTじゃないとダメかも
>> しれないということで)
>>
>> 2008/10/6 陳捷 <[E-MAIL ADDRESS DELETED]>:
>>> 久保さん
>>>
>>> ご回答ありがとうございました。陳捷です。
>>>
>>> 久保さんの言ったように試したが、やっぱり失敗しました。ここで、外だしSQL文を
>>> 貼り付けます:
>>>
>>> テーブル MASTER_VENDER   主キー OWNER_CODE, VENDER_CODE, SUPPLIER_CODE
>>>
>>> テーブル MASTER_SUPPLIER 主キー OWNER_CODE, SUPPLIER_CODE
>>>
>>> -------------------------------------------------------------------------------------------------
>>> /*IF pmb.isPaging()*/
>>> SELECT  DISTINCT
>>>        MASTER_VENDER.OWNER_CODE,
>>>        MASTER_VENDER.SUPPLIER_CODE,
>>>        MASTER_SUPPLIER.SUPPLIER_NAME,
>>>        MASTER_VENDER.VENDER_CODE,
>>>        MASTER_VENDER.VENDER_NAME
>>> -- ELSE select count(*)
>>> /*END*/
>>> FROM MASTER_VENDER
>>> /*IF pmb.isPaging()*/
>>>    LEFT OUTER JOIN MASTER_SUPPLIER
>>>        ON  MASTER_VENDER.OWNER_CODE = MASTER_SUPPLIER.OWNER_CODE
>>>        AND MASTER_VENDER.SUPPLIER_CODE = MASTER_SUPPLIER.SUPPLIER_CODE
>>>                AND MASTER_SUPPLIER.DELETE_FLG = '0'
>>> /*END*/
>>> /*BEGIN*/
>>> WHERE
>>>        MASTER_VENDER.DELETE_FLG = '0'
>>>        /*IF pmb.ownerCode != null */ AND MASTER_VENDER.OWNER_CODE =
>>> /*pmb.ownerCode*/''/*END*/
>>>        /*IF pmb.supplierCode != null */ AND MASTER_VENDER.SUPPLIER_CODE =
>>> /*pmb.supplierCode*/''/*END*/
>>>        /*IF pmb.venderCode != null */ AND MASTER_VENDER.VENDER_CODE =
>>> /*pmb.venderCode*/''/*END*/
>>> /*END*/
>>> /*BEGIN*/
>>> GROUP BY
>>>        MASTER_VENDER.OWNER_CODE,
>>>        MASTER_VENDER.SUPPLIER_CODE,
>>>        MASTER_SUPPLIER.SUPPLIER_NAME,
>>>        MASTER_VENDER.VENDER_CODE,
>>>        MASTER_VENDER.VENDER_NAME
>>> /*END*/
>>> /*IF pmb.isPaging()*/
>>>        /*$pmb.orderBy*/
>>> /*END*/
>>>
>>>  -- #MasterVenderSupplierLst#
>>>  -- *OWNER_CODE,VENDER_CODE,SUPPLIER_CODE*
>>>  -- !MasterVenderSupplierLstPmb extends SPB!
>>>  -- !!String ownerCode!!
>>>  -- !!String supplierCode!!
>>>  -- !!String supplierName!!
>>>  -- !!String venderCode!!
>>>  -- !!String venderName!!
>>> -------------------------------------------------------------------------------------------------
>>>
>>> また、dbfluteのバージョンは0.7.6
>>>
>>>
>>>
>>> 2008/10/03 23:37 kubo <[E-MAIL ADDRESS DELETED]>:
>>>> 久保(jflute)です。
>>>>
>>>> 陳捷さん、こんばんは
>>>>
>>>> 試しにですが、以下のように修正して
>>>> 実行して頂けますでしょうか?
>>>>
>>>> = = = = = = = = = = = =
>>>> -- #SimpleMember#
>>>>
>>>> select ... from ...
>>>> = = = = = = = = = = = =
>>>>>>>> = = = = = = = = = = = =
>>>> select ... from ...
>>>>
>>>> -- #SimpleMember#
>>>> = = = = = = = = = = = =
>>>>
>>>> 以前、DB2でフィードバック頂いた情報に合致するかどうか
>>>> 確認したいと思います。
>>>>
>>>> http://dbflute.sandbox.seasar.org/contents/outside-sql/sql2entity.html
>>>> 「また、SQL文の後ろに宣言しないとDBによって例外になって
>>>> しまうこともありますのでご注意下さい(DB2)。」
>>>>
>>>>
>>>> #
>>>> # あと、すいません。
>>>> # DBFluteのバージョン教えて頂けますでしょうか?
>>>> #
>>>>
>>>> 2008/10/3 陳捷 <[E-MAIL ADDRESS DELETED]>:
>>>>> お疲れ様です。陳捷です。
>>>>>
>>>>> 外だしSQLを作って、sql2entity.batを実行したら、エラーが出てきました。
>>>>>
>>>>> -------------------------------------
>>>>>        at org.seasar.dbflute.task.DfSql2EntityTask$2.execSQL(DfSql2EntityTask.java:303)
>>>>>        at org.seasar.dbflute.helper.jdbc.sqlfile.DfSqlFileRunnerBase.runTransaction(DfSqlFileRunnerBase.java:90)
>>>>>        at org.seasar.dbflute.helper.jdbc.sqlfile.DfSqlFileFireMan.execute(DfSqlFileFireMan.java:34)
>>>>>        at org.seasar.dbflute.task.DfSql2EntityTask.doExecute(DfSql2EntityTask.java:129)
>>>>>        at org.seasar.dbflute.task.bs.DfAbstractTexenTask.execute(DfAbstractTexenTask.java:107)
>>>>>        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>>>>>        at org.apache.tools.ant.Task.perform(Task.java:364)
>>>>>        at org.apache.tools.ant.Target.execute(Target.java:341)
>>>>>        at org.apache.tools.ant.Target.performTasks(Target.java:369)
>>>>>        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>>>>>        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
>>>>>        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
>>>>>        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>>>>>        at org.apache.tools.ant.Main.runBuild(Main.java:668)
>>>>>        at org.apache.tools.ant.Main.startAnt(Main.java:187)
>>>>>        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
>>>>>        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
>>>>> Caused by: com.ibm.db2.jcc.b.SqlException: executeQuery method cannot
>>>>> be used for update.
>>>>>        at com.ibm.db2.jcc.b.zc.a(zc.java:2387)
>>>>>        at com.ibm.db2.jcc.b.zc.a(zc.java:1684)
>>>>>        at com.ibm.db2.jcc.b.zc.a(zc.java:497)
>>>>>        at com.ibm.db2.jcc.b.zc.executeQuery(zc.java:481)
>>>>>        at org.seasar.dbflute.task.DfSql2EntityTask$2.execSQL(DfSql2EntityTask.java:219)
>>>>>        ... 16 more
>>>>> ------------------------------------
>>>>>
>>>>> 外だしSQL文はGroup Byを使っています。なお、コメントで主キーを定義するところで、メインテーブルの
>>>>> 主キーはidentityなので、記入していないです。
>>>>>
>>>>> ご回答をお願いします。
>>>>> _______________________________________________
>>>>> Seasar-user mailing list
>>>>> [E-MAIL ADDRESS DELETED]
>>>>> https://ml.seasar.org/mailman/listinfo/seasar-user
>>>>>
>>>> _______________________________________________
>>>> Seasar-user mailing list
>>>> [E-MAIL ADDRESS DELETED]
>>>> https://ml.seasar.org/mailman/listinfo/seasar-user
>>>>
>>> _______________________________________________
>>> Seasar-user mailing list
>>> [E-MAIL ADDRESS DELETED]
>>> https://ml.seasar.org/mailman/listinfo/seasar-user
>>>
>> _______________________________________________
>> Seasar-user mailing list
>> [E-MAIL ADDRESS DELETED]
>> https://ml.seasar.org/mailman/listinfo/seasar-user
>>
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>


Seasar-user メーリングリストの案内