Search code examples
sqlorientdb

OrientDB: How to update column using select query


I need to update a column in table using following:

update Table1 set name = (select productName from Table2 where
@rid=$parent.$current.productid)

Query works fine but instead of name query stores value in "[productname]" format.

I have read orientdb documentation, I guess select query returns result in collection format. so I have already tried following functions

  • get(1)
  • first()
  • [0] etc (my desperate attempt :)

Thanks in advance.


Solution

  • I tried searching but did not get any clean ans, but i making following change worked for me & got the job done :)

    update Table1 set name=(select productname from Table2 where
    @rid=$parent.$current.productid), 
    name= name.replace("\[","").replace("\]","")
    

    Hope this saves time for someone.