0

We have a requirement where we need to add entries of TABLE1 into TABLE2 based on WHERE clause.

the only relevant document/blog I found is https://cap.cloud.sap/docs/node.js/cds-ql#insert-as and https://blogs.sap.com/2022/06/21/getting-started-with-cds.ql-in-nodejs-for-cap-101-on-how-to-query-data/

as of now I have implemented the below query which I am triggering through function defined in .cds file

const c = await INSERT.into("TABLE1").
        as(SELECT.from("TABLE2").where({STATUS : 'X'}))

getting below 400 error.

 {
      "error": {
        "code": "400",
        "message": "Expected uri token 'EOF' could not be found in 'functionName();' at position 37"
      }
    }
Suncatcher
  • 10,355
  • 10
  • 52
  • 90
Abhi
  • 433
  • 2
  • 7
  • 17
  • I think I would separate the calls. I'm not sure what causes the error per se, but the second `SELECT` is not a list of entries but a promise since you're not `await`ing it. – Jorg Mar 02 '23 at 22:00

0 Answers0