Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Substitute variable in SQL statements

  1. #1
    Join Date
    Dec 2015
    Posts
    6

    Default Substitute variable in SQL statements

    Hi Team,
    I am facing in achieving this.
    I have a table which is having sql queries as rows in it. Those sql queries have certain variables in its filter condition. I am trying to execute those SQL using "Execute row SQL Script" but not able to replace those variables with user's input.
    And if I try to achieve it using "Execute SQL Script" then there is a challenge as the SQL script is present in a table.
    Please help me on this.

  2. #2
    Join Date
    Nov 2014
    Posts
    150

    Default

    Hi, Kritika09.

    I've tried to reproduce the scenario you described, as you can see in the image below:

    Name:  Captura de tela de 2015-12-30 10-21-32.png
Views: 254
Size:  6.7 KB

    First, I get the values from instructions column. In the second step, I substitute variables for their values, which come from another variable. Finally I execute them.

    Here's how I've set up the 'Replace in String' step:

    Name:  Captura de tela de 2015-12-30 10-21-45.jpg
Views: 249
Size:  5.6 KB

    As you can see, the variable in the search field is escaped.
    Last edited by hrcerq; 12-30-2015 at 08:47 AM.
    Best Regards,

    Hugo Cerqueira
    Business Intelligence / Data Warehouse Analyst

  3. #3
    Join Date
    Dec 2015
    Posts
    6

    Default

    Hi Hugo,

    Thanks. Now it has worked for me as well.
    This is really a great help. Thanks a lot !!
    Have a very Happy New Year !!

    Regards
    Kritika

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.