Passing null to Optional SQL ServerStored Procedure parameters for Query

Has anyone been able to pass null to a SQL Server Stored Procedure in a query for Interactive Reporting. I have a procedure that modifies the sql statement if the user passes additional filter data and I want to pass null to it. It works great if I use in reporting services, but I am being forced to us IR. Any help would be appreciated.
And just a point of issue...why do I have to use an ODBC driver to see or use my stored procedure!! Sorry couldn't resist!
Edited by: BISolutionBuilders on Jun 29, 2009 10:08 PM

Why dynamic sql ? It can be static, you are just passing the filter value

Similar Messages

  • How to create an External Content Type with SQL Stored Procedures Parameters and query it in a SharePoint App

    Hi,
    I'm new to SharePoint 2013 I want to be able to query a MSSQL database from a SharePoint App I have tried to create an External Content Type (ECT) which is produced from a MSSQL stored Procedure, this procedure has several parameters which are needed to
    filter the data correctly.  From here I want to produce an external list which I can then query from a c# SharePoint app.  If I leave the filters in the ECT null then the list is of course empty or if enter a default values the results are limited
    for the app to query so are no good.
    I want to dynamically pass values to the ECT when querying from the app, is this not possible.  Should I just be returning everything in an external list and then letting the query in the app filter the data, this seems inefficient?
    Is this the best way to do this or should I be doing this differently?
    Please can someone point me in the right direction.
    Thanks

    Hi Pandra801,
    When you create a the external content type, please try to add a filter based on your select statement.
    http://arsalkhatri.wordpress.com/2012/01/07/external-list-with-bcs-search-filters-finders/
    Or, try to create a stored procedure based on your select statement, then create ECT using the SQL stored procedure.
    A step by step guide in designing BCS entities by using a SQL stored procedure
    http://blogs.msdn.com/b/sharepointdev/archive/2011/02/10/173-a-step-by-step-guide-in-designing-bcs-entities-by-using-a-sql-stored-procedure.aspx
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • How to call pl/sql stored procedure in JDBC query dialogbox

    Hi,
    how to call pl/sql stored procedure in JDBC query dialogbox(reports 9i) .
    Cheers,
    Raghu

    please refer : Re: problem If you have more doubts, please ask in that question.

  • Running a SQL Stored Procedure from Power Query with Dynamic Parameters

    Hi,
    I want to execute a stored procedure from Power Query with dynamic parameters.
    In normal process, query will look like below in Power Query. Here the value 'Dileep' is passed as a parameter value to SP.
        Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData 'Dileep'"]
    Now I want to pass the value dynamically taking from excel sheet. I can get the required excel cell value in a variable but unable to pass it to query.
        Name_Parameter = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        Name_Value = Name_Parameter{0}[Value],
    I have tried like below but it is not working.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData Name_Value"]
    Can anyone please help me with this issue.
    Thanks
    Dileep

    Hi,
    I got it. Below is the correct syntax.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData '" & Name_Value & "'"]
    Thanks
    Dileep

  • PL/SQL - Using procedure parameters inside cursor definition.

    Hello all,
    I'm currently working on a procedure that has a cursor in it. The only parameter passed in when calling it is a table name (TABLE_NAME parameter) which I want to use as a string in a LIKE comparison inside the defined cursor.
    Here is the code:
    PROCEDURE PURGE (TABLE_NAME IN VARCHAR)
        IS
            CURSOR TABLES_CUR
            IS
                SELECT
                    OBJECT_NAME
                FROM
                    SYS.DBA_OBJECTS
                WHERE
                    OWNER = 'MYSCHEMA'
                    AND OBJECT_TYPE = 'TABLE'
                    AND OBJECT_NAME like 'TABLE_NAME_%'
                    AND CREATED = sysdate-3;
            TABLE_DEL TABLES_CUR%rowtype;
        BEGIN
            OPEN TABLES_CUR;
            LOOP
                FETCH TABLES_CUR INTO TABLE_DEL;
                EXIT WHEN TABLES_CUR%NOTFOUND;
                DBMS_OUTPUT.PUT_LINE('TABLE_DEL');
            END LOOP;
            CLOSE TABLES_CUR;
        END PURGE;However TABLE_NAME parameter value is not being interpolated, so cursor ends up returning nothing.
    What must I do to get it interpolated and not interpreted as a literal string?
    Thanks in advance.
    Frank.

    Alex Nuijten wrote:
    OBJECT_NAME like your_parameter||'%'
    That's it, thanks a lot Alex.
    I'm such a stupid.. :(

  • Passing Null value to MS SQL Server from Oracle BPEL

    Hi,
    We are using the DB adapter to invoke a procedure on MS SQL Server database. We need to pass null parameter to one of the parameters.
    When we pass 'null', we are getting a conversion error.
    Please provide your inputs.
    Regards.
    John

    The datatype is int.
    When we pass "null" we are getting the following error.
    Error while converting to a Java object. Unable to convert the XSD element ss_status_id whose SQL type is INT and JDBC type is INTEGER. Cause: java.lang.NumberFormatException: For input string: "null" ; nested exception is: ORABPEL-11803 Error while converting to a Java object. Unable to convert the XSD element ss_status_id whose SQL type is INT and JDBC type is INTEGER. Cause: java.lang.NumberFormatException: For input string: "null" Check to ensure that the XML data describing the object matches the definition of the element in the XSD. Contact oracle support if error is not fixable.
    After using xsi:nil="true", we are not getting any error as such. But the procedure is not giving expected data.

  • Do I run a shell script (bsh) via PL/SQL stored procedure?

    Hello guys,
    Do I run a shell script (bsh) via PL/SQL stored procedure?
    For example:
    procedure X is
    (variables)
    begin
    -- Read file data
    vFileHandle := utl_file.fopen('/mnt/novell/', 'file.txt','r');
    exception
    when 'INVALID READ FILE' then
    (I've to try running script to mount a Novell partition.);
    end;
    I've to installed Oracle 9.0.1 on Suse Linux.
    Please, any ideas or hints ...
    Thx and regards.

    You might be able to us the HOST command, I think you'd have to run it via dbms_sql, check this page for more details, not sure if it'll be of help but its worth a try..
    http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a82950/ch8.htm
    Cheers
    Rob

  • Passing array to pl/sql procedure - pls-00306 wrong number/types of args

    its oracle 10.2 database;
    I have a procedure with array parameters based on simple sql types.
    eg
    create or replace type vt_attrname is table of varchar2(50);
    Now my call to the procedure works when the array is empty;
    as soon as I bulk collect into my local array, I get a compilation error.
    eg
    declare
    my_array  vt_attrname;
    begin
    select label
      bulk collect
      into my_array
      from table_name
    where 1=1;
    my_proc(p_array=>my_array);  -- syntax error
    end;if I pass null the call works but obviously array is empty.
    I have read something about varray's being incompatible between sqltypes and pl/sql.
    How do I get around this problem?
    The bulk collect is working okay.
    A small example would be appreciated.

    Yep, I spotted the syntax error earlier.
    However even though that seems to compile ok, I still get the problem with my package call.
    heres the actual call from the code
    vt_attrname and vt_attrvalues are types declared on another schema.
    I have redeclared them on the current schema now.
    create or replace type vt_attrname is table of varchar2(50);
    create or replace type vt_attrvalue is table of varchar2(500);
    create procedure <name>
    as
    v_cardapplattrtag   vt_attrname;
    v_cardapplattrvalue vt_attrvalue;
      for cardappl_cur in
        (select cardappl_id 
           from ci_cardappl
          where custcard_id = cur.document_logical_number)
        loop
        select label
          bulk collect
          into v_cardapplattrtag
          from ci_applver_attribute
          where applver_id = v_applver_id;
          v_array_size := v_cardapplattrtag.count;
        -- populate this array
        -- ppt_cardapplattrtag comes from ci_pplver_attribute
        --ppt_cardapplattrvalue -- various
    cci_setcardappl.SetCardApplAttrValue(
              pn_cardappl_id                 =>     cardappl_cur.cardappl_id,
              ppt_cardapplattrtag     =>      v_cardapplattrtag, -- works when null
              ppt_cardapplattrvalue   =>     NULL,
              pn_cardapplattrsize     =>     v_array_size,
              pv_arn                  =>     cur.application_request_id,
              pv_commit               =>    'FALSE');and the procedure protototype is
    PROCEDURE SetCardApplAttrValue(
              pn_cardappl_id           IN     NUMBER,
              ppt_cardapplattrtag     IN     VT_BPATTRNAME DEFAULT NULL,
              ppt_cardapplattrvalue   IN     VT_BPATTRVALUE DEFAULT NULL,
              pn_cardapplattrsize     IN     NUMBER,
              pv_arn                  IN     VARCHAR2,
              pv_commit               IN     VARCHAR2 DEFAULT 'FALSE');Edited by: Keith Jamieson on Sep 23, 2009 10:42 AM

  • Passing null value to stored procedure

    I am calling a stored procedure from ssis package. In my stored procedure I have parameters which is set to default value of null i.e if nothing is passed I need to assume the value of parameter to be null. 
    In ssis package I created a variable its a datetime variable but when I dont pass anything or blank 
    it automatically gets some date but instead I want it to pass NUll.
    Thank You for the help

    Hi Rama,
    SSIS evaluates null value in a date type variable as “12/30/1899 12:00:00 AM” by default. As long as the date type of the variable is date, it always gives “12/30/1899 12:00:00 AM” instead of null. This behavior still exists in SSIS 2012. So, I am afraid
    that you have to modify your stored procedure to yield to this by design behavior of SSIS.
    If you have concerns, I would suggest you submitting a wish at https://connect.microsoft.com/sql. 
    Connect site is a connection point between you and Microsoft, and ultimately the larger community. Your feedback enables Microsoft to make software and services the best that they can be, and you can learn about and contribute to exciting projects.
    Regards,
    Mike Yin
    TechNet Community Support

  • Pass values to stored procedure parameters

    I have a stored procedure in MS SQL 2005 that has a datetime parameter.  I want to be able to use the stored procedure but I only want to pass a date value and assume all times for this date. 
    When i add the stored procedure to the report it automatically creates the parameters and I don't know how to bypass them.
    Is it possible to create a date type parameter and then pass it to the stored procedure parameter?

    Hi Johua,
    Yes, you can create a date type parameter and pass it to a stored proc that accepts a datetime parameter.
    This will, however, need a container type of a report.
    1) Create a new report and also create a date parameter in this report
    2) Insert the original report as a subreport in, perhaps, the report header/footer section
    3) Create a formula with this piece of code:
         datetime({?Date},time(0,0,0));
    4) Link this formula with the subreport's stored proc parameter
    -Abhilash

  • Pass date range parameter  to SQL stored procedure.

    Hi,
    I'd like to pass a date range parameter from Crystal Reports to a sql stored procedure. Does anyone know if this is possible?
    I've had no problem passing standard datetime (single value) paramaters to and from but am struggling with getting a range value parameter to work.
    Environment: Crystal Reports 10/XI and SQL 2000 MSDE version or SQL 2005 Express Edition.
    Any help would be appreciated.

    C5112736 wrote:>
    > And then these 2 formulas 'Formula # 1' and 'Formula # 2' can be used to pass on to the stored procedure.
    Can someone please demonstrate exactly how to use formula results as date parameters to a SQL stored procedure?  Keep in mind, there are two parameters to the stored procedure.
    I have gleaned this much: Use Add Command and insert the procedure with
    EXEC ServerName.dbo.usp_sprocName;1 '{?StringParameter}'
    but if I try to do
    {CALL ServerName.dbo.usp_SprocName({@Formula1},{@Formula2})}
    then it gives the error "No value given for one or more required parameters". 
    Both of the parameters are VARCHAR(50).
    I have finally found this link: [http://msdn.microsoft.com/en-us/library/ms710248(VS.85).aspx|http://msdn.microsoft.com/en-us/library/ms710248(VS.85).aspx]
    This Microsoft site defines the format of the ODBC escape sequences, but I still do not know how to convince Crystal to insert it's parameter results or formula results.
    Pulling what's left of my hair out . . .
    ~ Shaun

  • Pass unicode data in SQL Server 2008 stored procedure parameter

    Hi,
    I want to pass unicode data in a SQL stored procedure. But I am not sure that how to append N with NVarchar datatype.
    For example I Create a table LocalizationTest and wants to insert a few records.
    Create table LocalizationTest
        Field1 NVarchar(255)
    INSERT INTO LocalizationTest
    VALUES(N'123 Illini Dr, 東皮奧里亞, 8989')
    the above given statement works.
    To explain it more , script A works but script B does not work.
    DECLARE @X NVARCHAR(255)
    [A]
    SET @X=N '123 Illini Dr, 東皮奧里亞, 8989'
    INSERT INTO LocalizationTest
    VALUES(@X)
    [B]
    SET @X= '123 Illini Dr, 東皮奧里亞, 8989'
    INSERT INTO LocalizationTest
    VALUES(@X)
    What is the correct way to execute script B because @X will be passed in a SQL Stored Procedure?
    Thanks
    Sharma M.

    If you do not pass the value as a Unicode value there is nothing left of the Unicode characters but question marks. Once this has happened, AFAIK there is no way to undo it (other than resetting the value as Unicode characters again).
    Affirmative.
    Demo - This is what happens if you convert UNICODE (nvarchar) to varchar with implicit conversion (try to force 2 bytes into one byte).
    3F hex is '?'.
    CREATE TABLE #LocalizationTest (Field1 VARCHAR(255))
    INSERT INTO #LocalizationTest
    VALUES(N'123 Illini Dr, 東皮奧里亞, 8989')
    DECLARE @X NVARCHAR(255), @dSQL NVARCHAR(MAX)
    SET @X=N'123 Illini Dr, 東皮奧里亞, 8989'
    INSERT INTO #LocalizationTest VALUES(CONVERT(NVARCHAR(255),@X))
    SET @dSQL = N'INSERT INTO #LocalizationTest VALUES(N'''+@X+''')'
    PRINT @dSQL
    EXEC sp_ExecuteSQL @dSQL
    SELECT *, Field1Bin=convert(binary(30), Field1) FROM #LocalizationTest
    DROP TABLE #LocalizationTest
    123 Illini Dr, ?????, 8989 0x31323320496C6C696E692044722C203F3F3F3F3F2C203839383900000000
    123 Illini Dr, ?????, 8989 0x31323320496C6C696E692044722C203F3F3F3F3F2C203839383900000000
    123 Illini Dr, ?????, 8989 0x31323320496C6C696E692044722C203F3F3F3F3F2C203839383900000000
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • PL/SQL Procedure Parameters PROBLEM

    Here's my problem:
    When we describe the successfully compiled PL/SQL packaged procedures in SQL*Plus, the parameter order seems reversed. For instance, my PL/SQL source looks like this:
    Create Package pkg1...
    Procedure func1 (param1 in varchar2,
    param2 in number) is
    ...function body...
    end func1;
    end pkg1;
    After it is successfully compiled in SQL*Plus, when I describe it using the desc command, it shows:
    PROCEDURE FUNC1
    Argument Name Type ......
    PARAM2 VARCHAR2
    PARAM1 VARCHAF2
    This problem occurs occasionally, if we recompile the source, it goes away. We couldn't quite tell when and how this happens. When the problem occurs, we checked the ALL_SOURCE view and verified that the parameters are in the right order.
    We use the Merant Drivers for our client side interfaces and whenever we have this problem on the db server, we get the "wrong number of types or parameters" error.
    Any clues, hints, solutions are greatly appreciated.
    Thank you for your time.
    On a different note, I couldn't find the appropriate forum to post this PL/SQL specific message, wondering why there isn't a PL/SQL forum.
    Murthy.

    Hi Yegneshwar
    Can U tell me how to invoke the procedure ? If all it can be invoked the post it or mail me and then I might help U out.
    Thank U.
    edwin

  • Passing ARRAYs to PL/SQL procedure

    Hi,
    How do i pass an array(from java program) to pl/sql stored procedure, and after doing some data manipulation in the database, i wanted to pass back the same array to the java program. Can anyone help me or post some sample code here?
    Thanks in advance.
    Kumar
    null

    Are you hoping to use JDBC or ODBC to pass this array? If JDBC, I'd suggest asking this question on the JDBC forum.
    Justin Cave
    ODBC Development

  • Need to pass the PROFILE options in SQL query

    SELECT ffvs.FLEX_VALUE_SET_NAME
    , ffvs.FLEX_VALUE_SET_ID
    , ffv.FLEX_VALUE_ID
    , ffv.FLEX_VALUE
    FROM fnd_flex_value_sets ffvs
    , fnd_flex_values ffv
    WHERE 1=1
    AND ffvs.FLEX_VALUE_SET_ID=ffv.FLEX_VALUE_SET_ID
    AND ffvs.FLEX_VALUE_SET_ID=1012493  -- SCHEME_GL_OPTION
    AND ffvs.FLEX_VALUE_SET_ID IN (select FLEX_VALUE_SET_ID from FND_FLEX_VALUE_RULE_LINES
    where
    FLEX_VALUE_RULE_ID
    in
    (select FLEX_VALUE_RULE_ID from FND_FLEX_VALUE_RULES where FLEX_VALUE_RULE_NAME='MDS ZA Option' ))
    I am trying to to run the particular SQL qyery for creating the VIEW.
    Concern:- It will pick all the columns of the values associated with all rules and GL account
    --> I want to filter out by running the or using the PROFILE option so that it returns for only one RESP_ID.
    Is it anyway to use in creating of view in the QUERY to pick the only one RESP_ID.
    Hope I made clear my issue.

    My questions is to use this FND_PROFILE.VALUE('RESP_ID') or FND_PROFILE.VALUE('ORG_ID')
    When ever you will run the above flex values query, it will come for all company or org id.
    I want specific for one org for all the flex values when i will run the above query.
    I try to initialize the query for the org_id,resp_id. But it returning for all of the org.
    I  have to filter out the values based on Org.Where as in the above query there is no org_id column for joing so how should i ?
    Hope i make my questions right.

Maybe you are looking for

  • Commit on abnormal termination of the program

    I just want to know if Oracle provides options at Connection Time, that it would commit on abnormal program termination. If yes, I want to use this feature in my Pro*C application, where I can commit after inserting every 1000 records only. So, even

  • Illustrator CS4 doesnt detect Intel proc

    Hello, I have a new imac 2.8GHz C2D machine.. I installed the CS4 design premium upgrade.. While i didnt have the previous product installed, i did enter my CS1 serial and that enabled me to continue the install. What i was noticing was that the illu

  • IMac can't share via Samba but works with AFP

    I have a home network with (almost) all Macs. Every computer shows up in the shared folder, but for some reason my iMac can't be connected to via Samba (error -36). It can be connected to via AFP. The iMac CAN connect to other computers via samba tho

  • How can I possibly download a purchased app on iphone?

    I just bought a new iphone5s and want to download an app that I already bought on my Mac. I have tried everything but it simply doesnt show the app in purchased list. The apple ID is the same I used when I bought the application. Anyone who can sugge

  • Using FCE to improve an iPhoto slide show exported DV file

    Hello everyone I was looking for a quick good way to create a slide show easily, without manually adding various transitions, panning etc.... Well, iPhoto makes a great slide show, fast n easy music and all. I've exported a Slide Show as a 'Large Siz