Trouble referencing BI Publisher parameters in SQL Query (nQSError: 46033)

Hello everyone,
I have a query that references some Parameters I created in BI Publisher. They are:
grade_var of type String
school_var of type String
school_year of type String
The SQL used to for the data model of the report is:
SELECT "KW School Year"."School Year", "KW Grade"."Grade Seq Nbr", "KW Grade"."Grade Desc", "KWC Enrolment"."Student Count", +(case WHEN "KW School"."School Name" = 'Campbell Collegiate' then "KW School"."School Name" else 'Z - Other School' end)+
FROM "Sask DW"
WHERE ("KW Student"."Student Nbr" IN
(SELECT "KW Student"."Student Nbr"
FROM "Sask DW"
WHERE ("KW School"."Post Secondary Institute Ind" = 'N')
AND ("KW Enrolment Outcome"."Enrolment Outcome" NOT IN ('Deceased', 'Transferred to out-of-country schooling', 'Transferred to out-of-province schooling'))
AND ("KW Grade"."Grade Desc" = :grade_var)
AND ("KW School"."School Name" = :school_var)
AND ("KW School Year"."School Year" = :school_year_var)) )
AND ("KW School"."Post Secondary Institute Ind" = 'N')
AND ("KW Enrolment Outcome"."Enrolment Outcome" NOT IN ('Deceased', 'Transferred to out-of-country schooling', 'Transferred to out-of-province schooling'))
AND +("KW School Year"."School Year" >= '2005/2006')+
The above query works great and I can get back results and throw them into a template and it works great. The problem comes when I want to change what is highlighted in italics text. School Name and School Year values are hard coded into the SQL but I want those to reference the value of the BI Publisher parameter. It seems to work fine in the bolded part but when I put the paramater name into the italics part, I get the error message:
java.io.IOException: prepare query failed[nQSError: 46033] Datatype: 25 is not supported.
The query I am trying to submit is (changes highlighted in bold):
SELECT "KW School Year"."School Year", "KW Grade"."Grade Seq Nbr", "KW Grade"."Grade Desc", "KWC Enrolment"."Student Count", *(case WHEN "KW School"."School Name"=:school_var then "KW School"."School Name" else 'Z - Other School' end)*
FROM "Sask DW"
WHERE ("KW Student"."Student Nbr" IN
(SELECT "KW Student"."Student Nbr"
FROM "Sask DW"
WHERE ("KW School"."Post Secondary Institute Ind" = 'N')
AND ("KW Enrolment Outcome"."Enrolment Outcome" NOT IN ('Deceased', 'Transferred to out-of-country schooling', 'Transferred to out-of-province schooling'))
AND ("KW Grade"."Grade Desc" = :grade_var)
AND ("KW School"."School Name" = :school_var)
AND ("KW School Year"."School Year" = :school_year_var)) )
AND ("KW School"."Post Secondary Institute Ind" = 'N')
AND ("KW Enrolment Outcome"."Enrolment Outcome" NOT IN ('Deceased', 'Transferred to out-of-country schooling', 'Transferred to out-of-province schooling'))
AND ("KW School Year"."School Year" >= :school_year_var)
The parameters are all of type string and all the columns I am comparing them to are VARCHAR. What doesn't make sense is that the parameters can be compared to the columns in the middle of the SQL but when I try a similar comparison near the beginning and at the end, I get the error shown above.
Any thoughts/tips?
Thanks!
Edited by: jmoe316 on Oct 21, 2009 9:43 AM
Edited by: jmoe316 on Oct 21, 2009 9:49 AM

Hi Jared,
Did you have any success with the syntax suggested? I am having the same issue and would like to know if using the parameter as part of the SQL query select statement is feasible. The goal is to have a column dynamically selected based on a parameter value. My example:
SELECT
CASE
WHEN :p_name = 'Joe' THEN table1.column_a
WHEN :p_name = 'Tom' THEN table1.column_b
ELSE table1.column_c
END
FROM ...
Regards
Edited by: user11929404 on Mar 14, 2011 1:18 PM
Edited by: user11929404 on Mar 14, 2011 1:20 PM

Similar Messages

  • How to make Multiple parameters to sql query string seperated by ,(comma) ..

    Hi,
    I would like to konw how I can make multiple parameters to sql query string seperated by ,(comma)  ..
    For example, this parameters can be printed like 'abc,dde,ggf,eeg' ,once I use  "join(Parameters!rpCode.Value,",")" with report builder , 
    By the way, when I test this multiple parameters by Query Designer of report builder there was no problem,.(using Define query parameters, I put abc,dde,ggf,eeg)
    however, when I run this report , it won't be executing ,  with (rsErrorExecutingCommand)
    Plz, help me....

    If its sql query then it should like this
    Select t.*
    from table t
    inner join dbo.ParseValues(@Parameters,',')f
    on f.val = t.ID
    ParseValues can be found him
    http://visakhm.blogspot.in/2010/02/parsing-delimited-string.html
    or easier way is
    Select t.*
    from table t
    where ',' + @Parameters + ',' LIKE '%,' + CAST(t.ID AS varchar(10)) + ',%'
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Using Parameters in SQL-Query not only in where clauses

    Hi,
    I try to use Publisher parameters in the SQL Query from a Data Set.
    All of them have default values.
    So far, this is no problem, unless I try to use such a parameter value as an ordinary attribute value:
    >
    select
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."BETR_TEIL"
                                            else :pv_some_Text end                                                                  as Betr_Teil,
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM"
                                            else :pv_some_Text end                                                        as Suva_Nr,
         case when (:pv_Group = 'no') then "DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH"
                                            else sum("DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") end      as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in (:pv_nim100)
         fetch first 65001 rows ONLY
    >
    The parameters 'pv_Group' and 'pv_nim100' are working fine. (when or where clauses)
    The parameter 'pv_some_Text' unfortunately not. (simple literals)
    When I try to validate the above SQL, I get the following Error:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46033] Datatype: 25 is not supported.
    </font>
    After use a cast function:
    >
    else CAST(:pv_some_Text AS CHARACTER)
    >
    I get this ERROR:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 19002] Incorrect use of parameters. The parameters used in CAST cannot be resolved without ambiguity.
    </font>
    We use OBIEE 11.1.1.6.4 on a Win64-System.
    Thank's for any help.

    Hi Alex,
    let's leave away any unnecessary details.
    This is the SQL, inserted in the window 'Edit Data Set' of BIP Data Model:
    >
    select
         '--1'     as Betr_Teil,
         '--2'      as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    Everything is fine when I click OK, the script goes back to the metadata.
    Let's try this script with bind values in ORACLE SQL Developer.
    This SQL is the physical part, found in the OBIEE-Log (Log level 5), except the bind values. Therefore we find, in the where clause, the join. In the logical sql, we don't have to join, because it's handled in the Common Enterprise Information Model (CEIM)
    >
    with
    sawith0 as
    select
    sum(t39617.ris_vollbesch) as c1
    from
    dm15d_betriebsteil t39455,
    dm15k_ris_fakten_pro_btt_jhr t39617
    where
    t39455.id_betriebsteil = t39617.id_betriebsteil
    and t39455.suva_nr_form = '122-4.4'
    select
    d1.c1 as c1,
    d1.c2 as c2,
    d1.c3 as c3
    from
    select
    :pv_some_text as c1,
    :pv_some_text as c2,
    sum(d1.c1) as c3
    from
    sawith0 d1
    d1
    where
    rownum <= 65001
    >
    This SQL works fine, even with bind values for 'pv_some_text'.
    But, when using the following SQL in the BIP Data Model:
    >
    select
         :pv_Text as Betr_Teil,
         :pv_Text as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    The following ERROR occurs:
    <font color="red">java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46008] Internal error: File server\Query\Optimizer\ServiceInterfaceMgr\Utility\Src\SQOIUTypeVisitor.cpp, line 643.</font>
    In my opinion, either I use a wrong syntax, or BIP has a problem with parsing the script.
    Thank you for your most welcome help.

  • How to pass two parameters to sql query

    I try to create a sql script to update two columns in one table. I want to set it as parameter. When people execute this sql script, they need to pass parameter into sql query, then query will be executed successfully. The problem is I am only able to pass one parameter. If set two parameters in one line code, it will get ORA-00933 errors. Please advice me where I was wrong. The code is simple and like this:
    update MY_TABLE set year = &year AND month = &month where application_type = 'xxxx';
    If I only have: update MY_TABLE set year = &year where application_type = 'xxxx'; It works. If I set two parameters to pass value. It will get error.

    Hi,
    When you UPDATE two or more columns in the same statement, use ',' instead of 'AND' to separate them:
    update  MY_TABLE
    set     year = &year
    ,       month = &month
    where   application_type = 'xxxx';The correct syntax for all SQL statements, including UPDATE, can be found in the [SQL Language manual|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10008.htm#sthref9598].

  • Adding h:dataTable with parameters in SQL query

    Hi,
    I've added a h:datatable to my web app in netbeans. I need this table to display records based on a sql query that contains a WHERE clause that has the currently logged-in user's id.
    Further I need a column with buttons that each perform an operation based on the primary key of the selected row.
    I have no Idea how to do any of this.
    Could anyone please help where to start or point me to a good tutorial.
    Thanks

    Hi BalusC.
    Thanks for the reply.
    Coincidentally I discovered your blog shortly after posting this question, and it has been a great help, thanks!
    I have another related problem now however. I am trying to display messages from the database, and then to allow a user to reply to these messages.
    Everything displays correctly and when I click on the reply link the right text area becomes visible, but for some reason, the action event of the last command button does not fire.
    Could you please help me figure out why it doesn't work.
    I also don't know how to retrieve the message from the right text area input.
    Thanks
    Here's the code in my Home.jsp
    <h:dataTable binding="#{Home.messageTable}" id="messageTable" value="#{Home.messages}" var="dataItem">
                                                                <h:column>
                                                                    <f:facet name="header">
                                                                        <h:outputText value=""/>
                                                                    </f:facet>
                                                                    <h:panelGroup layout="block" styleClass="message_main">
                                                                        <h:outputText styleClass="message_label" value="FROM :"/>
                                                                        <h:outputText styleClass="message_data" value="#{dataItem.sender}"/>
                                                                        <h:outputText styleClass="message_label" value="DATE :"/>
                                                                        <h:outputText styleClass="message_data" value="#{dataItem.dateString}"/>
                                                                        <h:outputText styleClass="message_label" value="SUBJECT :"/>
                                                                        <h:outputText styleClass="message_data" value="#{dataItem.subject}"/>
                                                                        <h:outputText styleClass="message_label" value="MESSAGE :"/>
                                                                        <h:outputText styleClass="message_body" value="#{dataItem.message}"/>
                                                                        <h:commandLink styleClass="message_label" action="#{Home.selectMessage}" value="Reply" />
                                                                        <h:panelGroup rendered="#{dataItem.selected}" layout="block" styleClass="reply_panel">
                                                                            <h:outputText styleClass="message_label" value="Enter reply:"/>
                                                                            <h:inputTextarea styleClass="message_body" />
                                                                            <h:commandButton action="#{Home.sendReply}" styleClass="message_label" value="Send Reply" />
                                                                        </h:panelGroup>
                                                                    </h:panelGroup>
                                                                </h:column>
                                                            </h:dataTable>And the related methods
    public String sendReply()
            Message msg = (Message)messageTable.getRowData();       
            msg.sendReply(?);// Needs the string value of the correct text area
            msg.setSelected(!msg.isSelected());       
            return null;
        public String selectMessage()
            Message msg = (Message)messageTable.getRowData();
            msg.setSelected(!msg.isSelected());
            return null;
        }

  • Having trouble writing to a database although SQL query is correct

    Hi there. I am trying to write an sql query to a database but I am failing to understand what is going wrong in terms of executing the query.
    I have the following code.
    static public int writeToStockTable (String suppIn, String nameIn, String typeIn, float quantIn, float priceIn, String descIn, String styleIn, String finishIn)         {               // Temporary variable to hold the SQL query               String SQLString, SQLString2;               ResultSet rs = null;                                     // Build a string containing the SQL INSERT instruction to be used later             SQLString = "INSERT INTO "+typeIn+" VALUES ('1', '" + suppIn + "', '" + nameIn + "', " + quantIn + ", " + priceIn + ", '"+descIn+"', '"+styleIn+"', '"+finishIn+"')";             SQLString2 = "SELECT Name FROM Suppliers WHERE Name = '" + suppIn + "'";                                         try                   {                         // The createStatement() method creates a Statement object.  Object will be                         // attached to my reference variable (statement) defined at the top of class.                         statement = connectionToBellFiresDB.createStatement();                                                 // The executeUpdate() statement can be used here to execute an                         // SQL INSERT instruction.                         rs = statement.executeQuery (SQLString2);                         if ((rs == null))                         {                             System.out.println ("Trying to say no supplier");                             return (-2);                         }                                                 else                         {                             System.out.println (SQLString);                             statement.executeUpdate (SQLString);                         }                                           }                 catch (SQLException exception)                   {                       return (-1);    // Return -1 if problem writing record to file                   }                             return (0);  // Return with 0 if record successfully written                       }
    Please ignore the attributes not used, it is very much a work in progress. The command that prints SQLString prints
    INSERT INTO Fireplace VALUES ('1', 'a', 'a', 1.0, 1.0, 'a', 'a', 'a')
    which is correct, but will return the error code -1 when asked to execute the query. The database jdbc:odbc driver has been initialised in the control panel and the program has no other problems accessing the database as far as i am aware.
    Any help would be appreciated, i hate database connections :)

    Chrift wrote:
    Im sorry i dont know what you mean by eating the exception, im quite a noob at programming to be honest!
    How do i print it out and what is a stack trace?Do you know what an exception is? If not, then you should stay far away from JDBC/Database programming for the time being.
    Read [the Exception Tutorial|http://java.sun.com/docs/books/tutorial/essential/exceptions/] first.
    Then: an exception has quite a bit of useful information attached that tells you what went wrong.
    In your case you catch the exception and ignore everything it could tell you by simply returning -1. Returning 0 and -1 to indicate success/failure is a very bad idea and should not be used in Java code, it's a C-style convention for C-era programming languages. In Java you use exceptions instead.
    For starters you could simply add "exception.printStackTrace()" in your catch-block to get some more information out of the exception.

  • How to bind/pass multiple input parameters to sql query in BPEL Process

    Hi,
    I have a requirement to invoke a query on a database table to fetch the records based on the few input values or bind variables?
    I have created a Partner link using the DBAdapter service and have used custom SQL, how can i bind and pass multiple bind/input parameters for these queries.
    foreg: if i have to query employee records based on name , desgination and age, these three params would be my input parameter that i will pass when i invoke the BPEL process, bow how can i pass these parameters to the partner link using DBADAPTER service.
    Please help
    Regards

    If the parameter-value is not known beforehand and cannot be determined based on the process instance data at that time, there are 2 options. Either invoke the PL/SQL procedure you named using a DB adapter service to get the value and pass it to the other DB adapter service. Or create a single service (e.g. PL/SQL procedure) that determines the parameter value, executes the query and returns the result. However, this is more a design issue. Does it makes sense to combine these actions in a separate service and use it or are these actions not related? You furthermore state that additional (DB adapter) services make the process heavier. Do you have strict requirements on the time process-instances may run or other such requirements? If not, I think the design-choice on whether combining these actions in a single service should have more priority.

  • Pass Multiple Parameters to SQL query in Drop down or Select Boxes

    Post Author: JasonW
    CA Forum: Data Connectivity and SQL
    Hello all- I am using CR XI and SQL server 2000.I have written a SQL statement and used that statement as a 'command' in the Database Expert, to pull data into a report.  There are two issues I have that I need some help/advice on.-. The report needs 4 parameters.  A, B, C, D.-. I can create Parameters in the Database Expert that will prompt me for the data when I refresh the report. However,-. I need to be able to select those parameters in drop down boxes based on data in the SQL database.  The problem is that the parameter cannot pull the data without the criteria - so a drop down box seems impossible.  OR is it?  That is part of my question.  The other part is - Even if it is possible, can Crystal do this somehow?  NOTE: The query is selecting the data rather than Crystal - so Creating a Parameter field IN the report is futile. -. The other half of this problem is that users would like the ability to select multiple values from Field A and from Field B.  

    Post Author: JasonW
    CA Forum: Data Connectivity and SQL
    I ended up using a stored procedure.  This queries the proper data, and allows me to use Dynamic Parameters to make multiple selections on the data.  (I query out a large portion of the data in the stored procedure, then pair it down using Dynamic Parameters in Crystal.) Here is the new problem this has created:My Dynamic Parameters are not pulling all the values from the query.  Ex.  One field in the query is a "directory" listing.  It has 227 unique values in it.  (It has multiple values, it is not constrained.)  When I create a Dynamic Parameter off of this field, I only get 18 of the 227 as available selections in the drop down box.  However, I can type in any of the 227 values into the field manually, I pull the proper data.  So the data is there, its just not showing up in the drop down box.   Anyone have any ideas on this?

  • Parameters in SQL Query

    Hi,
    I am using SPOOL in SQL Plus to generate a csv file.
    Before the start of query I am using following parameters:
    SET HEAD OFF
    SET PAGES 0 FEED OFF
    SET LINESIZE 800
    I have computed linesize by adding up all the field lengths in the select statement.
    On an average I am expecting my Select to generate more than 20K records.
    Based on your experience are there any other parameters you guys suggest me to set.
    Thanks in advance,
    Raja

    Thanks Leo and Peter I'll go thru it
    But meanwhile based on ur experience, plz advice me on anyother parmeters you think will be helpful to me in this case
    One more thing,I am triggering this script via MS-DOS batch script, so SQL Plus will actually be evoked in the MS_DOS command prompt, any param to consider for that..
    Please advice
    Message was edited by:
    Raja Gopalan

  • Passing Parameters to SQL Query and Displaying Result

    The user enters a serial number in a text box and then pushes a button to get info about the serial number. I do this with two regions. The first region has the text box and the button. The second region is a Report type region and contains the following SQL:
    select case
    when "WARRANTYSTATUS"."OUTOFWARRANTYDATE" >= sysdate then
    'Serial Number '||"WARRANTYSTATUS"."SERIALNUMBER"||' is in warranty.'
    else
    'Serial Number '||"WARRANTYSTATUS"."SERIALNUMBER"||' is out of warranty.'
    end as "The result is:"
    from "WARRANTYSTATUS"
    where "WARRANTYSTATUS"."SERIALNUMBER" in (:P1_SERIALNUMBER)
    For a single serial number of the form CU5-0799 every thing works. I am a little suprised this works because the SERIALNUMBER in the WARRANTYSTATUS table is of type varchar2 which means the serial number in the where clause must be surrounded by single quoties. Not sure where the single quoties are being added.
    However, what I like to do is to enter more that one serial number, seperated by commas, in the same text box, and then the query return a result for each serial number. What I would like to enter is:
    CU5-0799, CU5-07132, CU5-89345
    The problem is this string of three serial numbers will needs to be have single quotes around each serial number at the level of the sql statement. So the question is how do I make this work?? Thanks for the help in advance.

    Bob,
    If you would change your OTN handle to something more mnemonically friendly, that would help us. Thanks.
    This topic is addressed fully, with various techniques described, here: Re: Search on a typed in list of values .
    I am a little suprised this works because the SERIALNUMBER in the WARRANTYSTATUS table is of type varchar2 which means the serial number in the where clause must be surrounded by single quoties.
    Not true. Quotes are used for literals, not bind variables.
    Scott

  • Passing multiple parameters in sql query

    Hi All,
    This may not be the correct place to post this.
    How to pass multiple paramters to a variable in sql developer.
    Ex: Select * from Country where state= :statename (Country is table name, state is column name)
    If I execute the above query in SQL Developer I can pass only one parameter at a time for :statename ie either KERALA,KARNATAKA,PUNJAB etc.
    How can I pass multiple values (all KERALA,KARNATAKA,PUNJAB) or ALL column values at a time in SQL Developer.
    Thanks

    user1668671 wrote:
    How to pass multiple paramters to a variable in sql developer.A scalar variable by definition cannot store more than one value at a time.
    Array type variables can, as this example using the built in type odcivarchar2list shows
    SQL> select
      2      object_name,
      3      object_type
      4  from
      5      all_objects o
      6  where
      7      o.object_name in
      8      (select column_value from
      9      table(sys.odcivarchar2list('DUAL','ALL_OBJECTS')));
    OBJECT_NAME                    OBJECT_TYPE
    DUAL                           TABLE
    DUAL                           SYNONYM
    ALL_OBJECTS                    VIEW
    ALL_OBJECTS                    SYNONYM
    ALL_OBJECTS                    VIEWHere is a full discussion with multiple solutions for various versions including a string parsing
    http://tkyte.blogspot.com/2006/06/varying-in-lists.html
    Does SQL Developer support array type variable? I don't know they may know here {forum:id=260}
    Otherwise the link above shows how to parse a single character variable into multiple values that will be needed.

  • SAP Crystal Report (2008) through SQL Query parameters

    Hi,
    I Created a report in Crystal report (2008) based on Sql Query. I created parameters in SQL query prompt only (all single valued).
    Based on this I need to show the data in detail section.
    For Graph, I used another SQL query, and added one subreport to the Main report header section. Since this subreport is also using the SQL query prompts for taking parameters.
    Since both the reports are using same set of parameters. I mapped Main report parameters to sub-report parameters.
    So Now structure is like,
    In a report there is one subreport.
    Main report ....SQL query generates parameter prompt..same parameters is passed to subreport.
    In subreport there are sql generated prompts. and we mapped that prompts to main report parameter prompts.
    Now it is running fine from crystal report, but not from CMC. It is not showing the graph.
    Made Two Experiment:
    1. To check subreport is running or not , Mannualy put my name in sub report--working fine.(CMC)
    2. To check the parameters are correctly mapped--printed the value in subreport--Showing all the parameters value from CMC
    but it is not running the SQL query of that sub report.
    Any suggestion ?? Or is there anyoption to check?? Or a CMC setting.
    Please suggest and respond..
    Thank you in advance.!!

    Hi Rajeev,
    This is Crystal reports development community, you said the report is working fine in Crystal. it is problem in CMC. So the issue is at BI Server.
    So i think you need to create the thread in the below community.
    BI Platform
    --Naga

  • Sql query trouble

    Hi i am having trouble getting my head around an sql query. The query:
    "SELECT t.pub_name, tl.accountno
    FROM tenant_login tl, tenants t
    WHERE t.pub_name = '"+name+"' AND t.accountno = tl.accountno";
    produces a list of pub names and account numbers when an account number exists both in tenant_login and tenants.
    How do i create a query that lists the pubname and account numbers where the account number exists in tenants but NOT in tenant_login?
    Thanks

    SELECT t.pub_name, tl.accountno
    FROM tenants t
    WHERE t.pub_name = '"+name+"' AND t.accountno not in
    (select accountno from tenant_login )one small change i think
    SELECT t.pub_name, t.accountno
    FROM  tenants t
    WHERE t.pub_name = '"+name+"' AND t.accountno not in
    (select accountno from tenant_login )

  • How to pass parameter value as "where [fieldname] = [fieldvalue]" in sql query under query type in SSRS report?

    I am having trouble with passing dynamic string to sql query for executing SSRS reports.
    I am using oracle database and I want to pass where clause parameter as "where LAND_NR = 6" to my select query.
    For example: I want to execute Select * from employee :p_where.
    where p_where parameter holds value "where LAND_NR = 6"
    So it will treat as "Select * from employee where LAND_NR = 6" statement which will give me the list of records to display in my reports.
    But it's not taking correct sql command throwing an error as "SQLcommand not properly ended."
    How can I achieve this?

    You need to use dynamic sql
    But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
    This forum is specifically for SQL Server
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • APEX,PDF's, BI Publisher and SQL Query returning SQL code..

    I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
    I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
    Here is my dilemma:
    I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
    The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
    I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
    An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
    Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
    Thank you,
    Tony Miller
    UTMB/EHN
    Title adjusted to allow people to know what I am talking about...
    Message was edited by:
    Tony Miller

    Tony,
    You can find the log as follows:
    - go to http://[yourserver]:[yourport]/em
    - logon to OC4J EM: oc4jadmin/[yourpassword]
    - click on "logs" at the bottom of the page
    - in the hgrid/tree, expand OC4J->home->Application
    xmlpserver
    - click on view log icon
    You can also observe what's going on in BI Publisher
    by going to the command prompt from where you started
    it.
    Or, as a third option, you can locate the file on
    your file system, depending on your setup, the path
    would be something similar to this:
    \oracle\product\10.2.0\bip\j2ee\home\application-deplo
    yments\xmlpserver\application.log
    With that said though, I don't expect you'll find
    much in there that would help with your particular
    problem. I suspect you either get no rows in your XML
    at runtime, due to some session state issues, or your
    XML structure does in fact not match your RTF
    template.
    I'm not quite following your problem description,
    i.e. when did you do what and are you associating
    your report layout with a report query or report
    region. So just some general notes, your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query. If you want to
    use your RTF template with a standard report region,
    you must export the XML file first using the advanced
    XML structure option. And of course the column names
    in your report query need to match the column names
    in your report region.
    Perhaps this helps you further diagnose what's going
    on, if you have additional information that could
    help, let me know. And if you could stage this on
    apex.oracle.com, I'd be happy to take a look.
    Regards,
    MarcMarc,
    Thanks for looking at this issue. Below find my remarks to your questions..
    Re: your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query.At the start of this process, the query code was a function in a package. The function was returning an SQL select statement, for a report region on a page. I took the select statement, built an application query to build a sample of the xml for BI Publisher desktop (Add-on for Word). The code was producing the usual Col01, Col02.. since at design time that is were the column names.
    When I then took the xml from this and built the rtf for loading into my APEX application.
    When testing the Application Query with this RTF report layout, I am getting PDF's. When using it with the report region sending an xml feed to BI Publisher I am getting nothing back.
    I have since taken the sql code and moved it back into the report region, and set the region to have a type of straight SQL Query. I have even tried to hard-code the parameters I was getting from the page to limit data returned.
    Is it possible to see the xml being produced by the APEX page?
    Re: Stage this on apex.oracle.com.. I would love to, but we would have HIPPA issues if I posted the data on a public website.
    Can I send you the RTF file and the xml file that the application query is creating to see if there something weird about them?
    Thank you,
    Tony Miller
    UTMB/EHN

Maybe you are looking for

  • Select Expert using ISNULL

    I am using Crystal Reports XI and I have a table that has customer names with "NULL" values. I am wanting to print all of those records in the table with the NULL value. Can someone help me with this issue. Thanks Jim

  • Inventory 0IC_C03 Backward caluculation issue

    Hi experts, In Inventory reportm custom query, Kaydate with 365 days offset is used, there data is showing correct with Initialization date and future date. problem is for historical date some time negative and postive values are showing but mot matc

  • How to delete header

    How to delete the header? I want  to delete the header because it consumes space on my doc.

  • Mac Mini (2008) won't startup. 3 warning beeps and flashing light.  Anyone help?

    This mac is used in a school and has coursework saved on it.  Can anyone help or advise how to get info off the hard drive? Have already tried to firewire connect to another mac.

  • 9i Certification question

    I'm a bit confused by the 9i DBA path. It look like I have to sit the old 8i intro to sql and pl/sql exam first and then do it all over again for the new 9i INTSQL exam as well! Is this the case?