Update based on subquery DQL

Imran_Yusubov
edited June 18, 2012 in Documentum #1

Hello Experts,

is it possible to update records based on subquery in dql?

I am trying this but it fails,

update dm_folder f objects set f.owner_name (select u.user_name from dm_user u where u.user_name=f.object_name)

Please let me know what I am doing wrong, unfortunately I could not find anything in google.

Thanks in advance

Comments

  • argha.saha
    edited June 18, 2012 #2

    Hi Imran,

    Yes, this is possible. Try with the below DQL

    update dm_folder f objects set f.owner_name where f.owner_name = (select u.user_name from dm_user u where u.user_name=f.object_name)

    Refer to Documentum Content Server <version> DQL Reference Manual.pdf

    Hope this help you.

    Regards,
    Argha

  • Julien.Fontaine
    edited June 18, 2012 #3

    Exactly, you forget the Where clause !

  • Imran_Yusubov
    edited June 18, 2012 #4

    Error occured during query execution :[DM_QUERY_E_SYNTAX]error:  "A Parser Error (syntax error) has occurred in the vicinity of:  update dm_folder f objects set f."


  • aflowers001
    edited June 18, 2012 #5

    you are not setting f.owner_name

    try

    update dm_folder f objects set f.owner_name=u.user_name where f.owner_name = (select u.user_name from dm_user u where u.user_name=f.object_name)

    now I haven't attempted to parse/execute this but it might have an issue with the owner_name = (select u. as this may return > 1 record.

    might be worth updating via the dm_dbo.dm_folder_s and using a 'raw' sql style query