Passing a table into a procedure to be used in a curor

Hi,
I'm using Oracle 9.2.0.6
I have a procedure that searches all objects for a passed in string value. The procedure is below.
CREATE OR REPLACE PROCEDURE Find_String (
pin_referenced_name IN dba_dependencies.referenced_name%TYPE)
IS
cursor cur_get_dependancy
is
SELECT distinct owner, name, type
  FROM [email protected]
WHERE lower(referenced_name) = lower(pin_referenced_name) --'ftbv_salesrep_all_1d'
   AND referenced_type != 'SYNONYM'
order by name;
v_owner  varchar2(40);
v_name   varchar2(50);
v_type   varchar2(40);
    BEGIN
       dbms_output.put_line(upper(pin_referenced_name)||' is found in the following objects.');
       dbms_output.put_line(' ');
       dbms_output.put_line(RPAD('OWNER', 30, ' ')||RPAD('NAME', 60, ' ')||RPAD('OBJECT TYPE', 30, ' '));
       dbms_output.put_line('-------------------------------------------------------------------------------------------------------------------');
        FOR i IN cur_get_dependancy
        LOOP
            v_owner := RPAD(i.owner, 30, ' ');
            v_name  := RPAD(i.name, 45, ' ');
            v_type  := RPAD(i.type, 30, ' ');
            dbms_output.put_line(v_owner ||v_name|| v_type);
        END LOOP;
END find_string;I was wondering if there's any way I could pass in the table name, and the name of the DB link to be used in the cursor, into the procedure and rig the cursor to be able to accept that as a parameter. I want our users to be able to search different databases using this utility code.
I thought of NDS, and that would be a way to do it, however I'm not sure if I could use an NDS statement in conjunction with a cursor.
Does anybody have any suggestions?
Thanks

One approach (there are obviously many ways to skin this particular cat)
SQL> ed
Wrote file afiedt.buf
  1  declare
  2    c1           sys_refcursor;
  3    l_val        number;
  4    l_table_name varchar2(30) := 'dual';
  5  begin
  6    open c1 for 'select 1 from ' || l_table_name;
  7    loop
  8      fetch c1 into l_val;
  9      exit when c1%notfound;
10      dbms_output.put_line( l_val );
11    end loop;
12    close c1;
13* end;
SQL> /
1
PL/SQL procedure successfully completed.Justin

Similar Messages

  • Pass Structured table into dynamic table parameter in public method

    Ladies and Gentlemen,
    I have a requiremet to pass (1 at a time) any number of tables into a reuseable method in a custom class.  The Method code is as follows:
    method CREATE_OUTBOUND_FILE.
    * Importing VALUE( IV_PATHNAME )  TYPE PATHEXTERN File Destination
    * Importing VALUE( IT_FILE_RECORD ) TYPE REF TO DATA  Table with Output
    * Importing VALUE( IV_RECORD_STRUCTURE )  TYPE STRING OPTIONAL  Record Structure
    * Importing VALUE( IV_DELIMITER )     TYPE STRING     File Delimiter
    * Exporting VALUE( EV_RECORD_CNT )  TYPE STRING Record Count
      Data:
            ls_line_cnt(6) type n,
            lt_data_struc  type zty_ddic_struc_T,
            ls_string      type string.
      field-SYMBOLS: <fs_string> type any.
    * Open Dataset for outputting file details
      Open dataset iv_pathname for output in text mode encoding default.
      Assign ls_string to <fs_string> CASTING TYPE (iv_record_structure).
      loop at it_file_record into <fs_string>.
        transfer <fs_string> to iv_pathname.
        Add 1 to ls_line_cnt.
        clear <fs_string>.
      endloop.
      ev_record_cnt = ls_line_cnt.
    where IV_PATHNAME = output destination & filename
                IT_FILE_REC     = data table
                IV_RECORD_STRUCTURE = is ddic structure definition for the data table
                IV_DELIMITER = file delimiter, in this case, let's say it's C (for CSV)
         and EV_RECORD_CNT is a count of numbe of records processed.
    Lets say, for example, I wish to load data from table SFLIGHT into the method when program A is executed.  Then another time I wish to excute Program B which is passing in data of table  SFLCONN2.  I hope that by using the "type ref to data" defintion, I can pass the table contents through. Is this true?
    Secondly, I'm getting a syntax error saying that "IT_FILE_RECORD" is not defined as a table (and therefore can't be looped at), and therefore can't be read.  How can I access the data in this table in preparation for output.
    Any assistance or thoughts would be greatly appreciated.
    Regards,
    Steve

    Hi Stephen ,
    Graham already gve part of the solution.
    If you declare
    Importing VALUE( IT_FILE_RECORD ) TYPE REF TO DATA
    it does not make sense to declare to pass by VALUE because you will not change this refernce in the method. Calling this method, you must pass a refefernce.
    data:
      lr_ref type ref to data.
    get reference of <your itab here> into lr_ref.
    CREATE_OUTBOUND_FILE( ...IT_FILE_RECORD = lr_ref ... )
    In the method, it goes as graham explained.
    Anyway, I would declare the table parameter as
    Importing IT_FILE_RECORD TYPE TABLE
    The your code could work, but you will have troube with any non-character fields in the tables.
    Regards,
    Clemens

  • Passing function value into another procedure

    Hi
    From this package the value returned by the function " FIRST " needs to pass into another procedure as parameter in the same package, how could i do that in a better way.Oracle Version 8.1.7.4.0.
    CREATE OR REPLACE package body PKG_CUST_CHECK is
    FUNCTION FIRST(P_PARMS in varchar2) return varchar2 is
    l_parms varchar2(62) := P_PARMS;
    BEGIN
    SECOND(l_parms);     
         return(l_parms);     
    END;
    PROCEDURE SECOND(P_PARMS in out varchar2) is
    L_CUST Varchar2(30);
    BEGIN
    SELECT P_CUST INTO L_CUST FROM TABLE_A WHERE ROWNUM=1 ;
    THIRD(P_CUST in VARCHAR2,
    P_PARMS_VALID out VARCHAR2,
    P_OK_FOR_CUST out VARCHAR2,
    --Here the output of the above procedure will be concatinate and Return ;     
    END CUST_CHECK;
    end PKG_CUST_CHECK ;
    Thanks

    sorry for the confusion, not sure whether it will be clear enough.
    the requirement is function "FOURTH" should get the value returned
    by the function "FIRST" as in parameter value.
    [ code ] CREATE OR REPLACE package body PKG_CUST_CHECK is
    FUNCTION FIRST(P_PARMS in varchar2) return varchar2 is
    l_parms varchar2(62) := P_PARMS;
    BEGIN
    SECOND(l_parms);     
    return(l_parms); --here the value which is returning is updated one by the THIRD procedure       
    END;
    PROCEDURE SECOND(P_PARMS in out varchar2) is
    l_parms varchar2(62) := P_PARMS;
    BEGIN
    --the procedure THIRD will get the parameter values after
    --extracting the values from l_PARMS by another function EXTRACT
    THIRD(P_CUST in VARCHAR2,
    P_PARMS_VALID out VARCHAR2,
    P_OK_FOR_CUST out VARCHAR2,
    return;                    
    --Here the output of the above procedure will be concatinate and Return ;     
    END CUST_CHECK;
    FUNCTION FOURTH(P_PARMS in varchar2) return varchar2 is
    l_parms varchar2(62) := P_PARMS;
    BEGIN
    --the procedure FIFTH will get the parameter values after
    --extracting the values from l_PARMS by another function EXTRACT
    FIFTH(P_CUST in VARCHAR2,
    P_PARMS_VALID out VARCHAR2,
    P_OK_FOR_CUST out VARCHAR2,
    return;                    
    --Here the output of the above procedure will be concatinate and Return ;     
    END CUST_CHECK;
    end PKG_CUST_CHECK; [ /code ]

  • Passing internal tables into smartforms

    Hi All,
    I am testing a smartform for PO. But the smartform is already designed and it has two internal tables of type EKKO and EKPO. When i run the smartform its displaying the layout correctly but with no data ,which is true as the two internal tables have no data. So i want to fill those two internal tables based on the purchase order number/ numbers. So that i can test the smartform with those purchase order numbers.
    I want to create a parameter / select option in smartform so that when we enter the PO number those internal tables will be filled. How to create those options in the smartform.
    If i have to create through an ABAP program then i want to know how to pass those two internal tables to smartform. (Shall i have to call the FM couple of times and then pass those two internal tables).
    Thanks in Advance

    You fill the tables in the print program and pass the tables to the SmartForm function module under the tables section.  See the FM call below (CALL FUNCTION lf_fm_name)  and note that I am only passing in one internal table.  If you wish you may pass in more than one table.
    *&      Form  smartform_print
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM smartform_print .
      DATA: lf_fm_name            TYPE rs38l_fnam.
      DATA: ls_control_param      TYPE ssfctrlop.
      DATA: ls_composer_param     TYPE ssfcompop.
      DATA: ls_recipient          TYPE swotobjid.
      DATA: ls_sender             TYPE swotobjid.
      DATA: lf_formname           TYPE tdsfname.
      DATA: ls_addr_key           LIKE addr_key.
      PERFORM set_print_param USING      ls_addr_key
                                CHANGING ls_control_param
                                         ls_composer_param
                                         ls_recipient
                                         ls_sender
                                         retcode.
    *Get the Smart Form name.
      IF NOT tnapr-sform IS INITIAL.
        lf_formname = tnapr-sform.
      ELSE.
        MESSAGE e001(/smb40/ssfcomposer).
      ENDIF.
      IF vbdkr-vkorg = '0035'.
        IF w_regio = 'QC'.
          tnapr-fonam = 'ZPCC_INVOICE_FR'.
        ENDIF.
      ENDIF.
    *  IF NOT tnapr-sform IS INITIAL.
    *    lf_formname = tnapr-sform.
    *  ELSE.
    *    MESSAGE e001(/smb40/ssfcomposer).
    *  ENDIF.
    * determine smartform function module for invoice
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING  formname           = lf_formname
    *                 variant            = ' '
    *                 direct_call        = ' '
           IMPORTING  fm_name            = lf_fm_name
           EXCEPTIONS no_form            = 1
                      no_function_module = 2
                      OTHERS             = 3.
      IF sy-subrc <> 0.
    *   error handling
        retcode = sy-subrc.
        IF sy-subrc = 1.
          MESSAGE e001(/smb40/ssfcomposer).
        ENDIF.
        IF sy-subrc = 2.
          MESSAGE e002(/smb40/ssfcomposer).
        ENDIF.
        PERFORM protocol_update.
      ENDIF.
      CALL FUNCTION lf_fm_name
        EXPORTING
           archive_index              = toa_dara
    *   ARCHIVE_INDEX_TAB          =
           archive_parameters         = arc_params
           control_parameters         = ls_control_param
    *   MAIL_APPL_OBJ              =
           mail_recipient             = ls_recipient
           mail_sender                = ls_sender
           output_options             = ls_composer_param
           user_settings              = ' '
           vbdkr                      = vbdkr
           temp_jmval                 = temp_jmval
           temp_agval                 = temp_agval
           w_ship                     = w_ship
           w_ktgrd                    = w_ktgrd
           likp                       = likp
           w_trlrnbr                  = w_trlrnbr
           w_sealnbr                  = w_sealnbr
           w_booknbr                  = w_booknbr
           w_lc                       = w_lc
           w_shippoint                = w_shippoint
           billto_fedid               = billto_fedid
           soldto_fedid               = soldto_fedid
           shipto_fedid               = shipto_fedid
           vbco3                      = vbco3
           w_z4_address               = w_z4_address
           w_stawn                    = w_stawn
           w_herkl                    = w_herkl
           new_rate                   = new_rate
           vblkp                      = vblkp
          TABLES
           vbdpr                      = tvbdpr
    *       t_containers               = t_containers
    *       tdomvd                     = tkomvd
    *       da_xfplt                   = da_xfplt
    *       payment_split              = payment_split
    *       komk                       = komk
    *       frt_conditions             = frt_conditions
    * IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
    *   JOB_OUTPUT_INFO            =
    *   JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
    formatting_error           = 1
    internal_error             = 2
    send_error                 = 3
    user_canceled              = 4
    OTHERS                     = 5
      IF sy-subrc <> 0.
        retcode = sy-subrc.
        PERFORM protocol_update.
    * get SmartForm protocoll and store it in the NAST protocoll
        PERFORM add_smfrm_prot.
      ENDIF.
    ENDFORM.                    " smartform_print
    Davis

  • Passing a table as a procedure parameter

    I'm trying to pass a table_name as a parameter but it is not working. Any idea ???
    CREATE OR REPLACE PROCEDURE SIMM.populate_field
    ( field_name IN all_tab_columns.column_name%TYPE)
    IS
    v_a part_index_temp.no_dossier%TYPE;
    CURSOR c_temp IS
    SELECT no_dossier FROM part_index_temp FOR UPDATE;
    BEGIN
    OPEN c_temp;
    LOOP
    FETCH c_temp INTO v_a;
    EXIT WHEN c_temp%NOTFOUND;
    UPDATE part_index_temp a
    SET
    a.nouv_nom = (
    SELECT field_name
    FROM part_index_temp
    WHERE rnum= (SELECT (1+ABS(MOD(dbms_random.random,10)))
    FROM dual)
    WHERE CURRENT OF c_temp;
    END LOOP;
    CLOSE c_temp;
    END;

    What are you trying to accomplish?
    Describe the business requirement and we can help you.
    The way you are trying to pass in a Column name (not the table name) requires dynamic sql...

  • Pass a variable into a procedure as IN parameter

    Need some help from an experienced Oracle Guru. I have a stored procedure, which accept a VARCHAR called fiber_ids as parameter, it will use that variable in a simple query like this:
    select * FROM GEOTEL_SOURCE where ID IN (fiber_ids)
    the value of fiber_ids could something like 'AMFR00102005','AMFR00102006','AMFR00102007','AMFR00102008','AMFR00102009','AMFR00102010','AMFR00102015','AMFR00102016','AMFR00102017','AMFR00102049'
    The thing is that looks like the value of fiber_ids is not resolved into query. if I hardcode its real value there, it works, but it does not use its real value when running the procedure. I'm not an experience Oracle user, Please help. what's wrong with procedure? Thanks a lot!
    Tim

    Probably the variable value needs single quotes ('): if hard coding works then this must be the problem. Use a inner PL/SQL block instead of regular SQL statement to overcome the issue for selecting data based on varibale value.

  • How to pass an array to a procedure & how to use array in IN clause in SQL

    Hi all,
    how do i pass an array of varchar2[10] in an procedure and i want to use this array in the IN caluse of the SQL statement inside the procedure. Can anyone please help me on this.
    Thanks & regards
    shyam~

    There are multiple ways. For example:
    SQL> create or replace
      2    type str10_tbl_type is table of varchar2(10)
      3  /
    Type created.
    SQL> -- Using TABLE operator
    SQL> create or replace
      2    procedure p1(
      3                 p_str10_tbl str10_tbl_type
      4                )
      5      is
      6      begin
      7          for rec in (
      8                      select  ename,
      9                              sal
    10                        from  emp,
    11                              table(p_str10_tbl)
    12                        where ename = column_value
    13                     ) loop
    14            dbms_output.put_line(rpad(rec.ename,10) || rec.sal);
    15          end loop;
    16  end;
    17  /
    Procedure created.
    SQL> set serveroutput on format wrapped
    SQL> exec p1(str10_tbl_type('KING','ALLEN','SMITH'));
    KING      5000
    ALLEN     1600
    SMITH     800
    PL/SQL procedure successfully completed.
    SQL> -- Using MEMBER OF method
    SQL> create or replace
      2    procedure p1(
      3                 p_str10_tbl str10_tbl_type
      4                )
      5      is
      6      begin
      7          for rec in (
      8                      select  ename,
      9                              sal
    10                        from  emp
    11                        where ename member of p_str10_tbl
    12                     ) loop
    13            dbms_output.put_line(rpad(rec.ename,10) || rec.sal);
    14          end loop;
    15  end;
    16  /
    Procedure created.
    SQL> set serveroutput on format wrapped
    SQL> exec p1(str10_tbl_type('KING','ALLEN','SMITH'));
    SMITH     800
    ALLEN     1600
    KING      5000
    PL/SQL procedure successfully completed.
    SQL> SY.

  • The best way pass a goemetry to a procedure

    I need to pass a geometry to a stored procedure. I first thought of using the mdo.sys_geometry types but the java client cannot pass in this type of object. I then thought of using pl/sql tables to send in the sdo_element_info array and the sdo_ordinate_array info. I had a concern that the shape I passed in would surpass the sql buffer for the pl/sql ( if there is a buffer length as there is in sqlplus ). I also thought of using a long datatype to pass in an infinite string that I can parse and and create the goemetry in the stored procedure. Anybody have any thoughts as to the best way to pass a geometry into a procedure?

    They will be able to download everything that was bought with their Apple ID. If they all shared an ID then they switched to their own ID they won't be able to use any apps or music bought with another Apple ID. As I explained in my previous response. There is only one way to share apps and content across multiple Apple ID's and that is home share. So, NO there isn't a "Smooth" way to do it.

  • Passing Internal Tables

    I have a function ZMYFUNCTION belonging to ZMYFUNCTIONGRP function group.  In the TOP include of the group I have the following type declared:
    TYPES: BEGIN OF bundle_struc,
                      exidv  LIKE vekp-exidv,
                      vhilm  LIKE vekp-vhilm,
                 END OF bundle_struc.
    Now, in my function I declare an internal table:
    DATA: bundle_hu_tab             TYPE TABLE OF bundle_struc.
    I then try to pass this table into a FORM using the TABLES option.  My problem is that when I try to use
    FORM MYFORM TABLES p_bundle_hu_tab STRUCTURE bundle_struc.
    It says that bundle_struc is unknown.  If I remove the STRUCTURE I can't access any of the fields based by name. 
    I know I can always add bundle_hu_tab into the TOP include as well, but I'm trying to keep from doing that?  Is there any other way?

    Hi troy,
    1. Instead of declaring in the top include,
      <b>  create a structure of it,
       in DATA DICTIONARY thru se11.</b>
    2. then it will work.
    regards,
    amit mittal.

  • Pass Pl/sql table into USING clause in EXECUTE IMMEDIATE statment

    Getting error when I try to pass the PL/SQL table into USING clause in EXECUTE IMMEDIATE statment:
    Declare
    result NUMBER;
    TYPE values_tab IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    lv_tab values_tab;
    lv_exp varchar2(300);
    lv_exec varchar2(300);
    BEGIN
    lv_tab(1) := 5;
    lv_tab(2) := 48;
    lv_tab(3) := 7;
    lv_tab(4) := 6;
    lv_exp := ':b1+:b2+(:b3*:b4)';
    lv_exec := 'SELECT '||lv_exp ||' FROM DUAL';
    EXECUTE IMMEDIATE
    lv_exec
    INTO
    result
    USING
    lv_tab;
    DBMS_OUTPUT.PUT_LINE(result);
    END;
    Error at line 1
    ORA-06550: line 20, column 12:
    PLS-00457: expressions have to be of SQL types
    ORA-06550: line 15, column 8:
    PL/SQL: Statement ignored
    I am trying to evaluate the expression ":b1+:b2+(:b3*:b4)" which is stored in table. This table has different expressions (around 300 expressions). I want to use the bind variables in expression because each expression evaluated thousand of time may be more in some case. If I don't use bind variable then it fill shared pool.
    Is there any way I can pass the USING (IN) parameters dynamically instead of writing "USING lv_tab(1), lv_tab(2), lv_tab(3), lv_tab(4)"? As number of input parameters change depend on the expression in the table.
    If not possible please suggest any other ideas/approches
    Please help..
    Edited by: satnam on Jun 11, 2009 11:50 AM

    Well, you keep changing reqs faster I can keep up. Anyway, assuming N-th bind variable (left-to-right) corresponds to collection N-th element:
    Declare
        result NUMBER;
        lv_tab values_tab := values_tab();
        lv_exp varchar2(300);
        lv_exec varchar2(300);
        lv_i number := 0;
    BEGIN
        lv_tab.extend(4);
        lv_tab(1) := 5;
        lv_tab(2) := 48;
        lv_tab(3) := 7;
        lv_tab(4) := 6;
        lv_exp := ':5000135+:5403456+(:5900111*:5200456)';
        lv_exec := lv_exp;
        While regexp_like(lv_exec,':\d+') loop
          lv_i := lv_i + 1;
          lv_exec := REGEXP_REPLACE(lv_exec,':\d+',':b(' || lv_i || ')',1,1);
        end loop;
        lv_exec := 'BEGIN :a := ' || lv_exec || '; END;';
    DBMS_OUTPUT.PUT_LINE(lv_exec);
    EXECUTE IMMEDIATE lv_exec USING OUT result,IN lv_tab;
    DBMS_OUTPUT.PUT_LINE(result);
    END;
    BEGIN :a := :b(1)+:b(2)+(:b(3)*:b(4)); END;
    95
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How to pass a table as parameter on a stored procedure

    Hello all,
    I want to pass the name of a table as parameter into a stored procedure, that will be used for cursors etc.
    But when i pass the parameter and i compile the S.P. it give me error (error: table not existing...)
    Any Help?
    Thanks in advance, Marco

    Marco wrote:
    As i've written above, i'm using stored procedures like 'batch' programs which will be executed with oracle scheduler (passing to s.p. the name of the 'input' tables)
    These input tables are 'external' tables which have got the same structure; for example i've got TABLEX_001, TABLEX_002, XXTAB etc. with the same structure.
    This is the the reason... what do you think?An external table definition can reference multiple files via the LOCATION definition or you can user "ALTER TABLE" to alter the location and change the file that the external table points to.
    Thus you only need one static External Table and use an alter table (via execute immediate) to change the file location it points to, or if you want all the data together, just specify all the files in the location.
    That would be clean design, using one fixed table, without the need to pass any table names, just dynamically altering the file names if necessary at run time.

  • Pass table name to procedure

    hi
    Can any one plz suggest me , how to pass
    table name (that would be varchar) to a procedure,such that i
    should be able to do DML and DDL on the table refered !!

    EXECUTE IMMEDIATE executes the SQL statement held in a specified
    VARCHAR2. So, with a bit of string concatenation, you can make
    the statement dynamic, thus:
    EXECUTE IMMEDIATE 'DELETE * FROM emp' ;
    could become:
    EXECUTE IMMEDIATE 'DELETE * FROM '||p_table_name ;
    where p_table_name is a VARCHAR2 parameter passed into your
    procedure. Check out the PL/SQL User's Guide and Reference,
    chapter 10, for full details.

  • Passing the name of a table to a procedure

    Can anyone tell me how you can pass the name of a table to a procedure ?
    I am trying to write a generic procedure that will have the table name and the fieldname passed to it :-
    as in :-
    Select Fieldname FROM Tablename;
    null

    Refere to the documentation of
    built in package dbms_sql.

  • How to Pass multiple parameter into single store procedure

    How to Pass multiple parameter into single store procedure
    like a one to many relationship.
    it is possible then reply me immediatly

    you mean like this .....
    CREATE OR REPLACE procedure display_me(in_param in varchar2,in_default in varchar2 := 'Default') is
    BEGIN
    DBMS_OUTPUT.put_line ('Values is .....'||in_param || '....'||in_default);
    END display_me;
    CREATE OR REPLACE procedure display_me_2 as
    cnt integer :=0;
    BEGIN
    For c1_rec In (SELECT empno,deptno FROM test_emp) Loop
         display_me(in_param => c1_rec.empno);
         cnt := cnt+1;
         end loop;
         DBMS_OUTPUT.put_line('Total record count is ....'||cnt);
    END display_me_2;
    SQL > exec display_me_2
    Values is .....9999....Default
    Values is .....4567....Default
    Values is .....2345....Default
    Values is .....7369....Default
    Values is .....7499....Default
    Values is .....7521....Default
    Values is .....7566....Default
    Values is .....7654....Default
    Values is .....7698....Default
    Values is .....7782....Default
    Values is .....7788....Default
    Values is .....7839....Default
    Values is .....7844....Default
    Values is .....7876....Default
    Values is .....7900....Default
    Values is .....7902....Default
    Values is .....7934....Default
    Values is .....1234....Default
    Total record count is ....18

  • Ssrs 2008 r2 pass mutiple values to stored procedure that is being called

    In an SSRS 2008 r2 report, I am currently calling a stored procedure called spRoom. I obtain the results of the stored procedure by creating a  temptable called #roomReults
    The temp table that I am creating and using to obtain results looks like the following:
    CREATE TABLE #roomResults(
                     studentID VARCHAR(15),
       endYear SMALLINT,
                     calendarID INT) 
    INSERT  #roomResults
           EXEC [dbo].[spRoom] @endYear, @calendarID 
    Currently I am only passing in one value for both paramters called: @endYear and @calendarID. However now I want to pass
    in several values to each parameter.
    I want to change the sql to look like the following:
     EXEC [dbo].[spRoom] IN (@endYear), In (@calendarID)
    The above gives me syntax errors.
    Thus I am wondering if you can show me how to change the sql listed above so that that I can pass in more than one value from the SSRS report parameters called @endYear and  @calendarID to the stored procedure called [spRoom]?

    Wendy
    What version  are you using? Since SQL Server 2008 we  can use table valued parameter
    Create a user-defined data type with a single column.
    Develop a procedure with a table variable as an input parameter.
    Declare a table variable of the type of the user defined data type.
    Loading 10 records into the table variable and pass the table 
    variable to the stored procedure.
    create type tt_example AS TABLE
     (spid int)
    go
    create procedure usp_example
     @spids tt_example READONLY
    AS
     SELECT *
     FROM @spids
    GO
    declare @spids tt_example
    insert into @spids
    select top 10 spid
    from sys.sysprocesses
    exec usp_example @spids=@spids
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for

  • TEXT to be retrieved from a DOMAIN and to be displayed in an ALV report.

    Hi, I am required to develop a report where, the retrieved data needs to be displayed in an ALV. In the Report Specification, the requirement is that a text needs to be retrieved from a DOMAIN. e.g. Text to be retrieved from Domain EICST where Fix Va

  • Custom Purchase Oder Report Printing

    Hi All, We have custom purchase order report XML with Default Output Type as PDF, the report as such has no issues with it. We would like to capture the print count on the po_headers_all each time the custom report is printed by the user. I would be

  • No real offline reading of irm-protected documents possible?

    we are irm-protecting documents with some policy and then downloading. Adobe Reader always asks for (X509) credentials upon opening the document. This would be fine for first-time-usage - but not for subsequent usage. When saving the file locally and

  • Maintain superscript format in TOC?

    Hi there-- I'm generating a book in which some chapter titles and headings contain superscript TM or registered TMs (e.g. "How to use Kleenex(TM)," where the (TM) is superscript). When I generate the TOC, the superscript is lost, and the TM just appe

  • Test app in device, not found the info the BBDD

    Hi everybody! I try to test my app in the iphone device, but i have a problem. When I enter into the app the info which have to display a table from BBDD isn't appear. I don't know why... What I have to do to see the info? Thank you in advance!