Clarity

 View Only
  • 1.  SQL Param string not working

    Posted Dec 02, 2016 03:05 PM

    I have a gel script that uses a query to select resources in a specific OBS. That OBS is entered via a parameter on the script. If I use a string as the parameter value I get no rows returned. If I use a number I get rows. Any idea what I am doing wrong? When I enter parameter in process I enter it in single quotes eg 'Corp Fin'.

    Here are relevant snippets for string:

    <gel:parameter default =""Corp Fin'" var="obslevel3"/>

     <sql:query escapeText="0" var="results">
       <![CDATA[

    SELECT...

    FROM ...

    ...WHERE NBI_DIM_OBS.LEVEL3_NAME = ? 
    ]]>
    <sql:param value="${obslevel3}"/>
    </sql:query>

     

    Here are relevant snippets for number:

    <gel:parameter default="5105001" var="obslevel3"/>

    <sql:query escapeText="0" var="results">
       <![CDATA[

    SELECT...

    FROM ...

    ...WHERE NBI_DIM_OBS.LEVEL3_UNIT_ID = ?  
    ]]>
    <sql:param value="${obslevel3}"/>
    </sql:query>



  • 2.  Re: SQL Param string not working
    Best Answer

    Posted Dec 05, 2016 04:02 AM

    When I enter parameter in process I enter it in single quotes eg 'Corp Fin'

    String parameters should not need quotes in them as they are already strings - have you tried just Corp Fin then (apologies if I'm misunderstanding what you mean)



  • 3.  Re: SQL Param string not working

    Posted Dec 05, 2016 01:22 PM

    Thanks Dave. That worked. I thought I had to get the single quotes in there the same way as in a standalone sql statement.