Passing Dynamic Values to a Stored Procedure

I have a stored procedure to create a Table. How to I pass a
value to the procedure to name the Table. This SP works except the
name of the table is @newcomm not the value I am trying to pass in.
What is the proper syntax to make this happen.
CREATE PROCEDURE [dbo].[sp_newcommenttbl]
@newcomm varchar (50)
AS
BEGIN
CREATE TABLE [dbo].[@newcomm] (
[configid] [int] IDENTITY (1, 1) NOT NULL ,
[email] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[adminemail] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[erroremail] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[toCommentFormEmail] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[gmdsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[dbusername] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbpassword] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[acfcpath] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[acfcpath2] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[acfcpath3] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[urlactivate] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[urlresetpassword] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[initialized] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename1] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename2] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename3] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename4] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename5] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename6] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename7] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename8] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename9] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename10] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[pageheader] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
END
GO
<cfstoredproc procedure="sp_newcommenttbl"
datasource="xxxxx" returncode="no">
<cfprocparam type="in" maxlength="50"
cfsqltype="cf_sql_varchar" value="pighg3">
</cfstoredproc>

When I create the procedure I don't get an error. I get an
error when I call it.
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect
syntax near the keyword 'ON'.
ColdFusion cannot determine the line of the template that
caused this error. This is often caused by an error in the
exception handling subsystem.
Here is the call.
<cfstoredproc procedure="sp_newcommenttbl"
datasource="pisecurity" returncode="no">
<cfprocparam type="in" maxlength="50"
cfsqltype="cf_sql_varchar" value="pighg3" variable="newcomm">
</cfstoredproc>
Here is the syntax for the SP.
CREATE PROCEDURE [dbo].[sp_newcommenttbl]
@newcomm varchar (50)
AS
BEGIN
EXEC('CREATE TABLE [dbo].['+@newcomm+'] (
[configid] [int] IDENTITY (1, 1) NOT NULL ,
[email] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[adminemail] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[erroremail] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[toCommentFormEmail] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[gmdsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[dbusername] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbpassword] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[acfcpath] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[acfcpath2] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[acfcpath3] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[urlactivate] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[urlresetpassword] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[initialized] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename1] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename2] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename3] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename4] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename5] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename6] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename7] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename8] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename9] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[dbtablename10] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[pageheader] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL
ON [PRIMARY]')
END
GO

Similar Messages

  • Passing multi-value parameter in stored procedure ssrs

    I have  customer parameter which is a drop down list in my report and I have set it to "allow multiple values". This is an SSRS report.
    How do I pass multiple values to my stored procedure?
    RJ

    Hi ,
    Create a Table valued function in SQL Functions  as below 
    Step 1
    CREATE FUNCTION [dbo].[FnSplit]
    @List nvarchar(2000),
    @SplitOn nvarchar(5)
    RETURNS @RtnValue table 
    Id int identity(1,1),
    Value nvarchar(100)
    AS  
    BEGIN
    While (Charindex(@SplitOn,@List)>0)
    Begin 
    Insert Into @RtnValue (value)
    Select
    Value = ltrim(rtrim(Substring(@List,1,Charindex(@SplitOn,@List)-1))) 
    Set @List = Substring(@List,Charindex(@SplitOn,@List)+len(@SplitOn),len(@List))
    End 
    Insert Into @RtnValue (Value)
    Select Value = ltrim(rtrim(@List))
    Return
    END
    Step 2 in your store procedure change the parameter where condition something like below
    ALTER PROCEDURE [dbo].[SomeSP] 
    -- Add the parameters for the stored procedure here
    @CostCentre NVARCHAR(255)
    SELECT
    [ProjectCode],[ProjectName],[ProjectManager],SUM([Hours]) AS [Hours MTD]FROM dbo.Rpt_NRMA_CATS NC
    INNER JOIN PeriodID P ON NC.PeriodID=P.PeriodID
    WHERE 
    ([CostCentre]) collate database_default IN(SELECT Value FROM dbo.FnSplit(@CostCentre,','))
    END
    I hope this will help you.
    Dasari

  • Passing multiple values to a stored procedure

    Hi All,
    I have a stored procedure which displays a chart. The header of this procedure is:
    create or replace procedure chart ( p_period IN VARCHAR2) is
    When calling this procedure with something like the folloeing:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=MONTH">
    everything works OK.
    Now, I would like to replace p_period=MONTH with a value coming from an ITEM on the page, so something like:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=:P13_PERIOD">
    However, the above doesn't work.
    Can anyone give me the correct syntax please?
    Also what would be the syntax for passing more than one value? ie:
    source=ohsinit.chart?p_period=:P13_PERIOD,p_start=:P13_START_DATE ?
    Regards,
    Pawel.

    Hi Denes,
    I am not sure I understand your post...
    What I am trying to do here is to pass 3 values namely
    P13_PERIOD (VARCHAR2),
    P13_START_DATE (DATE),
    P13_END_DATE (DATE)
    into a stored procedure which displays the graph.
    So far I managed to get it working using:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=&P13_PERIOD.">
    However when I try to put in:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=&P13_PERIOD.,p_start=&P13_START_DATE.">
    I get the graph blank (but not the orange timeout message... if you are familiar with XML/SWG graphs.)

  • How to pass javascript variable to PLSQL stored procedure

    Hi,
    How can I pass a javascript variable to a database procedure. I have a form with a radio button group and would like to save the value of the selected radio button to a database table by passing the value to the stored procedure.
    Thanks

    Hi
    You can use iframe to call the procedure. Here is an example used in dynamic page or pl/sql portlet. The pl/sql procedure is called myprocedure and resists in the schema myschema. This example passes 2 parameters, but I have not yet reased a limit.
    First the call within a javascript function:
    myiframe.location.href="myschema.myprocedure?p_myprameter1=" + vJvascriptparameter1 + "&p_myprameter2=" + vJvascriptparameter2;
    Then the iframe:
    <iframe id="myiframe" height="0" width="0" frameborder="0"></iframe>
    You can let the pl/sql procedure print a value, that can be used i the portlet. You can get the value in a javascript this way:
    myvalue=top.window.frames["myiframe"].document.body.innerHTML;
    Best regards
    Klaus

  • URGENT: I want to pass a variable to a stored procedure at run time

    Post Author: aruplabs
    CA Forum: Data Connectivity and SQL
    I work for a health care provider and I have reports that pull PHI (Protected Health Information) about patients that needs to be logged according to federal HIPAA regulations. One of the pieces of information that needs to be logged is the username of the person who ran the report. Since these reports will be run from our Crystal Enterprise server I can get this from the CurrentCEUserName variable but I am looking for a way to pass this value to a stored procedure that will not only return the records for the report, but also log the disclosure in our PHI disclosure tracking table. I know you can pass a parameter to a stored procedure but I dont know how, or if it is even possible, to pass a run time variable. This is an urgent problem that I need to find a solution for. Any help would be appreciated.
    Thank you.

    Here it is. Right now, when i press te "Go" it runs for the specific time i've set and when its done the variable "Run" is set true. When i call this VI from another VI it waits for the loop to be finished before it will read the variable.
    Regards
    Viktor
    Attachments:
    Untitled 2.vi ‏26 KB

  • Passing CLOB datatype to a stored procedure

    Hi,
    How do I pass a CLOB value to a stored procedure?
    I am creating a stored procedure which appends a value to a CLOB datatype. The procedure has 2 in parameter (one CLOB and one CLOB). The procedure is compiled but I'm having problem executing it. Below is a simplified version of the procedure and the error given when the procedure is executed.
    SQL> CREATE OR REPLACE PROCEDURE prUpdateContent (
    2 p_contentId IN NUMBER,
    3 p_body IN CLOB)
    4 IS
    5 v_id NUMBER;
    6 v_orig CLOB;
    7 v_add CLOB;
    8
    9 BEGIN
    10 v_id := p_contentId;
    11 v_add := p_body;
    12
    13 SELECT body INTO v_orig FROM test WHERE id=v_id FOR UPDATE;
    14
    15 DBMS_LOB.APPEND(v_orig, v_add);
    16 commit;
    17 END;
    18 /
    Procedure created.
    SQL> exec prUpdateContent (1, 'testing');
    BEGIN prUpdateContent (1, 'testing'); END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'PRUPDATECONTENT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Any help or hints please.
    null

    sorry I made a mistake with the in parameter types - it's one NUMBER and one CLOB.

  • How to pass the parameter of a stored procedure to iReport

    Hi... i don't know how to pass the parameter of the stored procedure to the iReport.
    In the Report Query, i tried
    1. sp_storedprocedure ' value'
    2. sp_storedprocedure +''''+$P{parameter}+''''+
    3. sp_storedprocedure +$V+$P{parameter}++$F($F is a variable having a value of ' (a single quote))may you enlighten us please? thank you

    For M$ SQL server I find that it only works when U use the fully qualified name...
    e.g. catalod.dbo.my_procedure_name 'variable'
    My full query in the Report Query window is something like this:
    EXEC arc.dbo.jasper_Invoice 1000
    Note that you may find that selecting from VIEWS / TABLES fails for no apparent reason and iReport will prompt you with the usual very unhelpful (we have what we "pay" for) prompt, stating that "The document is empty".
    To work around this issue, where a statement like "SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id=1000" does not work, simply create a PROC, something like:
    CREATE PROC jasper_MyProc (@my_rec_id integer) AS
    SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id= @my_rec_id integer
    ...to wrap your SELECT statement, then call the PROC
    Edited by: Sylinsr on Apr 22, 2008 4:23 PM

  • How to Pass Dynamic values to XML in flex

    Hi,
    i just want to pass dynamic values. it must be stored in XML
    List or XML .for Ex: In my App i want to pass
    Edu_Institute,From_date,To_Date,Qualification fileds to
    Education table. I have used Webservices to connect with the
    Backend.
    At that time of processing, i want to pass 2 or more sets of
    Dynamic Values of Edu_Instiute,From_Date,To_Date....... to my
    webservice .
    i fetch the Edu_Institute value from text1.text From_Date
    from Datefield1.text etc... when i click the Add Button it must be
    stored in XMLnode[0],XMLnode[1]......& i will pass this nodes
    to my table
    How to do that??
    Can anyone please find out the solution for me??
    Thanks
    Regards,
    Thenmalar v

    Are you asking how to build XML in Actionscript?
    If so, the "literal" syntax is easy:
    var xmlData:XML = <root><text
    myAttr={test1.text}</root>
    You can also work directly with the XML class methods.
    Tracy

  • How to pass an array to a stored procedure

    create or replace package demo_pkg
    as
    type cityArray is table of city%rowtype index by binary_integer;
    procedure city_report( p_inputs in cityArray );
    end;
    CREATE OR REPLACE PACKAGE BODY demo_pkg
    AS
    PROCEDURE city_report (p_inputs IN cityarray)
    IS
    BEGIN
    FOR i IN 1 .. p_inputs.COUNT
    LOOP
    DBMS_OUTPUT.put_line ( 'citycode = '
    || p_inputs (i).city_code
    || ' CITYDESCRIPTION = '
    || p_inputs (i).city_description
    INSERT INTO testing
    (city_code, city_description
    VALUES (p_inputs (i).city_code, p_inputs (i).city_description
    commit;
    END LOOP;
    END;
    END;
    to call that procedure ia m using this
    declare
    my_data demo_pkg.cityArray;
    begin
    my_data(1).city_code := 1234;
    my_data(1).CITY_DESCRIPTION := 10;
    my_data(2).city_code := 4567;
    my_data(2).CITY_DESCRIPTION := 20;
    my_data(3).city_code := 4321;
    my_data(3).CITY_DESCRIPTION := 30;
    demo_pkg.city_report( my_data );
    end;
    but actually the procedure (demo_pkg.city_report)is called from front end(.net).how they will call this procedure in .net invironment

    Hi,
    Your exact question has been asked before, see: http://asktom.oracle.com/pls/ask/search?p_string=How+to+pass+an+array+to+a+stored+procedure
    or do a search on this forum.
    And please use this tag => (yes, just the 4 characters forming the word 'code' between curly brackets)
    *before* and *after* your example to maintain formatting and indentation, it's hard to read now....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Trying to get a return value from a Stored Procedure

    Hi folks,
    I have been tasked with something I thought was simple, but apparently its not that simple.  I am trying to call a Stored Procedure in UCCX that will do some calculations and returns back an integer value.  The stored procedure call I have is:
    DECLARE @return_status int
    EXEC @return_status = dbo.CTTLoginPhone @CTTId = $EmployeeID , @PIN = $EmployeePIN , @PhoneNumber = $CallingPhoneNumber ;SELECT 'Return_Status' = @return_status
    When I run this in this the editor, I get back one row.  If I run this in the debugger, I do not get any errors back and the stored procedure runs fine, however the Return_Status is not set either.  What am I doing wrong?
    I have defined Return_Status with intial value of 0 and the stored proc should be returning back 1 or 2, but the Return_Status remains as 0
    Can someone please let me know if I need a DB GET after a DB READ or can I just use the DB READ standalone when calling stored procedure.
    All help will be really appreciated.
    Thank you.

    I am having the same issue here... any help would be greatly appreciated. I am on UCCX 8
    I am getting 1 row returned when I click "TEST" in the READ step but the DB GET step is going into the SQL Error branch.
    Here are some details and I have attached screen shots of my script DB steps.....
    I have a Stored Procedure that is very simple...
    CREATE PROCEDURE sp_test AS
    Select 'N';
    GO
    Ive created a dummy table with 1 field..
    TABLE: testTable
    FIELD: code
    Let me know if there are any more details I can provide....

  • Get a return value from a stored procedure.

    hi all ,
    i need to know where i am going wrong with the below code. I am trying to get a value from a stored procedure. the return type is int. The stored procedure works fine as i've debugged it. The variable have been declared correctly.
    int n = 0;
    proc = conn.prepareCall("{ ? = call SP_GETITEMCURRENTSOH(?,?) }");
                proc.registerOutParameter(1, java.sql.Types.INTEGER);
                proc.setString(1, locationCode);
                proc.setString(2, itemCode);
                proc.execute();           
                n = proc.getInt(1);thanks

    Hi ayub_a,
    According the [ *setString*|http://java.sun.com/javase/6/docs/api/java/sql/CallableStatement.html#setString(java.lang.String,%20java.lang.String)] method of the [*CallableStatement*|http://java.sun.com/javase/6/docs/api/java/sql/CallableStatement.html] interface, the first parameter must be a parameter name and not an ordinal position index !!!
    Edit : I've just found out the solution, it must be :
    int n = 0;
    proc = conn.prepareCall("{ ? = call SP_GETITEMCURRENTSOH(?,?) }");
                 proc.registerOutParameter(1, java.sql.Types.INTEGER);
                 proc.setString(2, locationCode);
                 proc.setString(3, itemCode);
                 proc.execute();           
                 n = proc.getInt(1);Edited by: Chicon on Jul 5, 2009 7:48 PM

  • How do I return two values from a stored procedure into an "Execute SQL Task" within SQL Server 2008 R2

    Hi,
    How do I return two values from a
    stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
    Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
    Something like ?
    CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
    @intPeriod INT,
    @strPeriod_Length NVARCHAR(1),
    @dtStart NVARCHAR(8) OUTPUT,
    @dtEnd NVARCHAR(8) OUTPUT
    AS
    then within the SSIS component; -
    Kind Regards,
    Kieran. 
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
    Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
    Add a script task to check ssis variables values using,
    Msgbox(Dts.Variables("User::strExtractStartDate").Value)
    Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
    Regards, RSingh

  • Pass dynamic values to search-query in wlp-syndication-config for RSS

    Hi All,
    I want to pass dynamic values to the <search-query> element for the <syndication-feed> node in the wlp-syndication-config.xml file for implementing RSS feeds.
    Here's a sample
    <syndication-feed>
              <name>RSSFeed</name>
              <search-query>cm_objectClassInstance=='Node' &amp;&amp; date == 'x'_</search-query>
              <search-type>pubmeta</search-type>
         </syndication-feed>
    I tried passing the parameter in the url but the feed doesn't read it. The only option i have is to manually put the value to get the content from the repository, which sucks...because the values can change any time. is there any way that I can avoid it
    Any help on this would be appreciated.
    Thanks,
    K

    James:
    Passing filters to an IR within the URL is described here
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/app_comp.htm#sthref989
    Varad

  • Pass a date parameter to Stored Procedure

    Hello friends,
    Can you help to pass a date parameter to Stored procedure from JSP. This is my code:
    In Oracle 9i I have this:
    PROCEDURE SP_EDORES(
    pfechaini IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field
    pfechafin IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field
    p_recordset OUT PKG_REP_CIERRE.cursor_type) AS
    In JSP have this:
    CallableStatement stmt = (CallableStatement)conn.prepareCall( "begin PKG_REP_CIERRE.SP_EDORES(?,?,?); end;" );
    stmt.registerOutParameter(3,oracle.jdbc.driver.OracleTypes.CURSOR);
    stmt.setDate(1,Date.valueOf("01-06-2005"));
    stmt.setDate(2,Date.valueOf("30-06-2005"));
    ResultSet rset = (ResultSet)stmt.getObject(3);
    while (rset.next()) {
    %>
    <TR>
    <TD ALIGN=CENTER> <%= rset.getString(1) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getString(2) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getString(3) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getInt(4) %> </TD>
    </TR>
    <%
    The Stored Procedure returns de Result set, however I think does not recognized the date format because I need it with this format dd-mm-yyyy.
    Thanks in advance

    to use Date you will need the oracle package.
    u can try this other solution: use String, not Date
    CallableStatement stmt = (CallableStatement)conn.prepareCall( "begin PKG_REP_CIERRE.SP_EDORES(?,?,?); end;" );
    stmt.registerOutParameter(3,oracle.jdbc.driver.OracleTypes.CURSOR);
    stmt.setString(1,"01-06-2005");
    stmt.setString(2,"30-06-2005");
    ResultSet rset = (ResultSet)stmt.getObject(3);
    while (rset.next()) {
    %>
    if this don't work you can change your PL/SQL to get Strings and do the conversion with TO_DATE in the sql statement.

  • Passing comma separated string to stored procedure

    Hi,
    There is thread with same query I created earlier and that was answered. That solution worked if I pass comma separated string containing IDs. But due to changes in the logic, I have to pass usernames instead of userIDs. I tried to modify the solution provided to use with this.
    Following the link to previous post :
    Re: Passing comma separated string to stored procedure
    ------Package-------
    TYPE refcurQID IS REF CURSOR;
    TYPE refcurPubs IS REF CURSOR;
    procedure GetAllPersonalQueue (p_user_name in nvarchar2, TestQID OUT Test.refcurQID
    , TestPubs OUT Test.refcurPubs);
    ------Package-------
    ------Package Body-------
    PROCEDURE GetAllPersonalQueue (p_user_name in nvarchar2, TestQID OUT Test.refcurQID, TestPubs OUT Test.refcurPubs) as
    BEGIN
    Open TestQID for
    select id from cfq where name in (p_user_name);
    Open TestPubs for
    SELECT qid FROM queues WHERE qid in(
    select id from cfq where name in (p_user_name));
    END GetAllPersonalQueue;
    ------Package Body-------
    Thanks in advance
    Aditya

    Hi,
    I modified the query as per the solution provided by isotope, after which the logic changed and I am passing username instead of userID in comma separated string.
    Following is the changes SP, which does not throw any error, but no data is returned.
    PROCEDURE GetAllPersonalQueue (p_user_name in nvarchar2, TestQID OUT Test.refcurQID, TestPubs OUT Test.refcurPubs
    ) is
    --local variable
    strFilter varchar2(100);
    BEGIN
    Open TestQID for
    select id, name from cfq where name in
    select regexp_substr(p_user_name||',','[a-z]+[0-9]+',1,level)
    from dual
    connect by level <= (select max(length(p_user_name)-length(replace(p_user_name,',')))+1
    from dual)
    Open TestPubs for
    SELECT qid FROM queues WHERE qid in(
    select id from cfq where name in
    select regexp_substr(p_user_name||',','[a-z]+[0-9]+',1,level)
    from dual
    connect by level <= (select max(length(p_user_name)-length(replace(p_user_name,',')))+1
    from dual)
    END GetAllPersonalQueue;
    Edited by: adityapawar on Feb 27, 2009 8:38 AM

Maybe you are looking for