-1

我已经一步一步地检查了我的选择是否正常——它们是。我对将所选结果与字符串连接起来的更新有问题:

select distinct om_id from kom_kontrole where master_id=428;

OM_ID

  1507


select jni from ob_mostowe where id_obiektu =
 (select distinct om_id from kom_kontrole where master_id=428);

JNI

01025180

update kom_prot_kontrole set nazwa_pliku = 
 (select jni from ob_mostowe where id_obiektu = 
   (select distinct om_id from kom_kontrole 
    where master_id=428)) || '_1_' || '2005' || '.pdf';




update kom_prot_kontrole set nazwa_pliku =
  (select jni from ob_mostowe where id_obiektu =
    (select distinct om_id from kom_kontrole where master_id=428)) || '_1_' || '2005' || '.pdf';

                                                                         *

第 1 行出现错误:ORA-00933:SQL 命令未正确结束

4

2 回答 2

0

你可以试试这个方法吗?

update kom_prot_kontrole set nazwa_pliku =
  (select jni || '_1_' || '2005' from ob_mostowe where id_obiektu =
    (select distinct om_id from kom_kontrole where master_id=428))

编辑:

当您只需要更新匹配的行时master_id=428,您需要添加另一个where,如下所示:

update kom_prot_kontrole set nazwa_pliku =
  (select jni || '_1_' || '2005' from ob_mostowe where id_obiektu =
    (select distinct om_id from kom_kontrole where master_id=428))
where master_id=428
于 2014-03-05T09:23:30.417 回答
-1

|| '1' || '2005' seems to be acting as an alias but I don't believe one can have alias there in an update statement. Remove that and it should work..I hope.

于 2014-03-05T10:38:47.937 回答