Forum Discussion

Anushka96's avatar
Anushka96
Frequent Visitor
2 years ago
Solved

How to insert dynamic content in a query

I'm trying to dynamicaly create plsql query in copy data node. But I can't use set varaible in that dynamic query as per the suggested method in auto completion. Following statement is my sql statement.

SELECT *
FROM (
    SELECT a.*, CAST(ROWNUM AS INTEGER) AS rnum
    FROM (
        SELECT * FROM DBO.TestData
    ) a
    WHERE ROWNUM <= 2000
)
WHERE rnum >= @variables('LastRow')

My Piplineline is like in the picture.

 



 

    • You can use the following dynamic content to build the query. Enclose the parameter within @{...} (string interpolation) wherever required:

      SELECT *
      FROM (
          SELECT a.*, CAST(ROWNUM AS INTEGER) AS rnum
          FROM (
              SELECT * FROM DBO.TestData
          ) a
          WHERE ROWNUM <= 2000
      )
      WHERE rnum >= @{variables('LastRow')}


1 Reply

    • You can use the following dynamic content to build the query. Enclose the parameter within @{...} (string interpolation) wherever required:

      SELECT *
      FROM (
          SELECT a.*, CAST(ROWNUM AS INTEGER) AS rnum
          FROM (
              SELECT * FROM DBO.TestData
          ) a
          WHERE ROWNUM <= 2000
      )
      WHERE rnum >= @{variables('LastRow')}