Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Named parameters in DataSet Query
Tomas.Vala
Hi,<br />
<br />
i am wondering what the status of subject is. My understanding is that even though DataSet parameters are required to have assigned non empty name, you can't afterwards refer them using name in actual Query. If true, that would be kind of inconsistent and weird.<br />
<br />
<strong class='bbc'>Traditional way of passing positional parameters that works, but is not very comfortable:</strong><br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SELECT
myfield
FROM
mytable
WHERE
mykey = ?</pre>
<br />
<strong class='bbc'>Passing a parameter value via parameter name that fails.</strong><br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SELECT
myfield
FROM
mytable
WHERE
mykey = :filterkey</pre>
<br />
<strong class='bbc'>Exception thrown:</strong><br />
<pre class='_prettyXprint _lang-auto _linenums:0'>org.eclipse.birt.data.engine.odaconsumer.OdaDataException: Cannot execute the statement.
org.eclipse.datatools.connectivity.oda.OdaException: Not all named parameters have been set: [filterkey] [SELECT...</pre>
<br />
I guess either the syntax used in my example is wrong or BIRT lacks named feature. The latter would be rather worrying as ORM provider I am using (Hibernate4) suggests use of named parameters and declares use of positional parameters as deprecated.<br />
<br />
Plus there would be obvious advantages of using named parameters instead of positional parameters in general, if available.<br />
<br />
Tested on BIRT 3.7.1.<br />
<br />
Anyone knows?<br />
<br />
Tomas
Find more posts tagged with
Comments
JasonW
Are you using the Query Builder or the textual jdbc data source. The Query Builder should support named parameters.
Jason
shweta@fin
<p>Hi Jason,</p>
<p> </p>
<p>Am using query builder in BIRT 4.4.1. However am not able to use named paramters. Only positional paramters(?) seem to work. I get an error "<span style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:15px;background-color:rgb(255,249,227);">java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0)."</span></p>
<p><span style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:15px;background-color:rgb(255,249,227);">Does BIRT not support named paramters at all or am I doing something wrong ?. Please let me know. What is the alternative to this ?</span></p>