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.

Similar Messages

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • XML CLOB out from a stored procedure

    I'm using Oracle 8.1.7 and OO4O(Oracle Objects for OLE)
    8.1.7.0.1
    I'm generating an XML string in a CLOB using the XSU in a stored
    procedure.
    I'm then trying to pass the CLOB as an out parameter for that
    procedure to an
    ASP page using OO4O. I get the following error on the line
    where I call the ExecuteSql
    method of the OO4O Database object:
    Error Type:
    Oracle Automation (0x800A01B8)
    OIP-04796: Error in creating object instance
    If anyone can give me a a solution to this or a better way to
    do it I would much appreciate it. I've tried using a function
    as well.
    It does work if the CLOB is pulled from a database field, so I
    think
    the problem lies in the CLOB coming from the getXML method.
    Since I'm
    creating and XML datagram from relational tables, it doesn't
    make much
    sense to save the generated XML to a CLOB field and then load it
    right
    back to pass to the web page.
    Thanks in advance...
    Here's my code for the stored procedure:
    Procedure SP_INI_XML
    (result OUT CLOB)
    IS
    queryCtx SYS.DBMS_XMLQuery.ctxType;
    begin
    queryCtx := SYS.DBMS_XMLQuery.newContext(... SQL
    statement ...);
    SYS.DBMS_XMLQuery.setRowTag(queryCtx,'INI');
    SYS.DBMS_XMLQuery.setRowsetTag(queryCtx,'ROOT');
    SYS.DBMS_XMLQuery.setXSLT(queryCtx, 'http://site/file.xsl');
    result := SYS.DBMS_XMLQuery.getXML(queryCtx);
    SYS.DBMS_XMLQuery.closeContext(queryCtx);
    end;
    Here's my code from the ASP page:
    Set ses = Server.CreateObject("OracleInProcServer.XOraSession")
    Set con = ses.OpenDatabase(DBServer,ConStr,0)
    Const ORATYPE_CLOB = 112
    con.Parameters.Add "str",Null,2,ORATYPE_CLOB
    con.ExecuteSql("begin SP_INI_XML(:str);end;")

    Ah yes I see. Sorry I misunderstood what you were suggesting. I'm currently working on a test script that uses an approach similar to the one you mentioned, but I'm having trouble resolving foreign key relationships with test data.
    I've no access to the tables or anything so it's proving to be a time consuming task!!
    Is it required that all fields are given a value, even if they have a "DEFAULT" defined for them within the procedure. At the moment I'm using a rather cumbersome approach to this:
    i.e.
    With cmmAddRequest
        .ActiveConnection = strConnect
        .CommandType = adCmdText
        .CommandText = strSQL
        .Parameters(0).Direction = adParamInput
        .Parameters(1).Direction = adParamInput
        .Parameters(2).Direction = adParamInput
        .Parameters(3).Direction = adParamOutput
        .Parameters(4).Direction = adParamOutput
        .Parameters(5).Direction = adParamOutput
        .Parameters(0).Value = "COMP"
        .Parameters(1).Value = "FRML"
        .Parameters(2).Value = "1"
        .Execute
        WScript.Echo(.Parameters(5).Value)
    End With

  • Passing XMLType Data into oracle stored procedure using JDBC

    Hi Friends,
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.
    Following are the environment details
    JDK Version: 1.6
    Oracle: 10g
    Server: Tomcat 6.x
    Thanks in Advance

    user4898687 wrote:
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.As stated - no.
    A 'file' is a file system entity. There is no way to pass a 'file' anywhere. Not PL/SQL. Not java.
    Now you can pass a file path (a string) in java and to PL/SQL.
    Or you can pass xml data (a string) in java and to PL/SQL. For PL/SQL you could use eithe a varchar2, if the xml is rather small, or a blob/clob.

  • 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.)

  • 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

  • Passing Comma separated input to stored procedure in IN clause

    Hi All,
    I have a query below in a stored procedure as like this
    Create PROCEDURE insertinfo
    @userids varchar(MAX)
    AS
    BEGIN
    INSERT INTO records
    (id
    ,name
    ,address1
    ,address2
    ,pincode
    SELECT
    id,
    name,
    addr1,
    addr2,
    pin,
    FROM userinfo
    WHERE userinfo.id in(@userids)
    END
    I am not using any dynamic sql. Its a simple insert into select query with multiple parameters supplied via thd @userids parameter. When i  run the query nothing is inserting in the "records" table. I have gone throught the web search have
    tried with few options but no result yet. The query works fine when i pass only a single value, but it does not work when is pass multiple values.
    Please guide on this.
    Your help is appreciated.
    Thanks,
    mds2907

    mds2907,
    CHeck this:
    --Method 1
    --Usage of TVP
    --Method 2
    --Usage of SPLIT fn()
    Create PROCEDURE insertinfo(@userids varchar(MAX))
    AS
    BEGIN
    INSERT INTO records
    (id,name,address1,address2,pincode)
    SELECT id, name,addr1,addr2, pin
    FROM userinfo
    WHERE userinfo.id in(select * from sample_split(@userids,','))
    END
    --Method3
    --Usage of Dynamic SQL
    Applicable only when the values in csv are integers
    like '1,2,3'
    Create PROCEDURE insertinfo(@userids varchar(MAX))
    AS
    BEGIN
    DECLARE @sql nvarchar(max)
    SET @sql='
    INSERT INTO records
    (id,name,address1,address2,pincode)
    SELECT id, name,addr1,addr2, pin
    FROM userinfo
    WHERE userinfo.id in('+@userids')'
    EXEC sp_executesql @sql
    END
    Sample_Split():
    CREATE FUNCTION dbo.sample_Split
    @RowData nvarchar(2000),
    @SplitOn nvarchar(5)
    RETURNS @RtnValue table
    Id int identity(1,1),
    Data nvarchar(100)
    AS
    BEGIN
    Declare @Cnt int
    Set @Cnt = 1
    While (Charindex(@SplitOn,@RowData)>0)
    Begin
    Insert Into @RtnValue (data)
    Select
    Data = ltrim(rtrim(Substring(@RowData,1,Charindex(@SplitOn,@RowData)-1)))
    Set @RowData = Substring(@RowData,Charindex(@SplitOn,@RowData)+1,len(@RowData))
    Set @Cnt = @Cnt + 1
    End
    Insert Into @RtnValue (data)
    Select Data = ltrim(rtrim(@RowData))
    Return
    END
    Usage of TVP for a scenario similar to yours is explained herE:
    http://blog.sqlauthority.com/2008/08/31/sql-server-table-valued-parameters-in-sql-server-2008/
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/0ead7ceb-3fdd-4625-aa82-1d4195f984b1/passing-multivalue-parameter-in-stored-procedure-ssrs
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Pass BPC SSIS variable to stored procedure

      Dear All
    We have a ssis package in which there is data flow task. There
    is a OLEDB source which uses “Data access mode” as sql command. We used OLEDB data source instead of execute sql task as the outuput is table format generated in Stored proc which is used in following task
    This task calls a stored procedure with a input parameter which will be appset name.   [EXEC ProcName '@BPCAPPSET']
    The stored procedure is executing fine without any issues.But when I pass variable containing appset name to that stored  procedure its not taking properly and package ending successful.
    The variable is “BPCAPPSET” it contains appset name which
    will be taken front end.
       However to test if this value is taken by stored procedure
    or not, I tried to hardcode and pass appset name to stored procedure. i.e exec
    ProcName Appset1.
      Appset1 is existing appset. It worked fine. But we want to
    put this package in all land scapes, such that whenever it is triggered it will
    take the appset as parameter and does the calculation in stored procedure.
       Please advice how to pass this variable to stored
    procedure.
    regards
    Prasad

      Hi Roberto
    Thanks for your mail.
    I have tried, but I am getting error that @BPCAPPSET scalar
    variable must be defined.
    I believe that @BPCAPPSET is system defined variable which
    will be passed from Data manager package. May be this is the reason it is not
    recognizing this variable?
    If so, should I define a variable in SSIS. How can we
    assign value of @BPCAPPSET to the newly defined variable?
    Please advise. Attached screenshot.

  • How to pass RECORD input type to stored procedure from JDBC?

    Hi,
    We have stored procedure which takes RECORD as input .
    We could execute the below script from oracle client tool and get the response.
    declare
    l_record app.batch_update.add_record;
    l_id number;
    begin
    -- memberNumber
    l_record.no := '123456700';
    -- Policy Number
    l_record.pno := '1234567'
    -- Status. This will always be NEW.
    -- Call to API to add record
    app.batch_update.add_request
    (p_record => l_record,
    p_id => l_id,
    end;
    We have requirement to construct RECORD input from Java application and pass it to callable statement.
    We have tried to construct it via STRUCT and pass it to callable statement but it didn't work.
    We have constructed it like the following but not sure whether it is correct. It was throwing error "java.sql.SQLException: invalid name pattern: app.batch_update.add_record
    StructDescriptor structdesc = StructDescriptor.createDescriptor
    ("app.batch_update.add_record", delConn);
    Object[] p1obj = {' 12345','124050'};
    STRUCT p1struct = new STRUCT(structdesc, delConn, p1obj);
    Not sure whether I am doing the logic correctly.
    Please point me to the correct approach.
    Thanks in Advice
    Thanks

    Wrap the method using a record-type parameter in PL/SQL; a simplified example follows. Add exception handling, translation of types etc. as needed.
    CREATE OR REPLACE PROCEDURE prc_wrap_prc_using_rec
    pv_my_field_01 IN VARCHAR2,
    pv_my_field_02 IN VARCHAR2,
    pv_my_field_99 IN VARCHAR2,
    pv_err_msg OUT VARCHAR2
    ) AS
    -- Non-scalar parameter
    pr_my_record user.pkg_rec_declarations.wr_a_record_decl;
    BEGIN
    -- Load the work record
    pr_my_record.pv_field_01 := pv_my_field_1;
    pr_my_record.pv_field_02 := pv_my_field_2;
    pr_my_record.pv_field_99 := pv_my_field_99;
    -- Call the procedure
    pkg_std_routines.prc_do_sumfin(pr_my_record, pv_err_msg);
    END;

Maybe you are looking for

  • HELP!! Black screen on my MacBook Pro after leaving open and on for over 8 hours.

    Hi everyone, This is the first time I'm using the discussion board as I haven't had any problems with my MacBook Pro since I bought it in November 2010. However, yesterday, I left my laptop on and open for over 8 hours without realising. When I came

  • Pages don't show up right in chrome??

    Hello! I'm working on a website for a ministry, and everything looks great in all browsers, except the donate page its all messed up in google chrome (latest version) here is the link: http://www.blueflame47.com/new/donate.html One interesting thing

  • Installing air applications returns error

    I am running windows 8.1 x64 All updates to applications return the same error. The AIR install.log is: [2014-06-26:09:48:49] Runtime Installer begin with version 14.0.0.110 on Windows 8 x86 [2014-06-26:09:48:49] Commandline is: [2014-06-26:09:48:49]

  • I get no thumbnails in Organizer (just a grey icon)

    I use Elements 8.0. After successfully opened over 900 pictures in Organizer (imported them from my harddrive), suddenly no thumbnails showed up when importing new pictures. Just a grey icon suggesting I should wait (but nothing happens). I deleted p

  • How Do I Change My Forum Password;  How Do I Stay Signed In?

    I posted about these issues in the Community Suggestion area of the board about two days ago, but have gotten no response. Does anyone know how to change your password to this forum?  I've searched high and low for a link, but can't find it. Also, mo