Clobs in stored procedures

I have a stored procedure which has a field that includes a CLOB.
These are the fields for this stored procedure:
PKEY NUMBER IN
ID VARCHAR2 IN
DESCRIPTION VARCHAR2 IN
COMMENTS CLOB IN
LAST_MODIFIED DATE IN
Now when i try to execute this stored procedure in SQL Plus or my VB program I am getting the following problem if the CLOB field isn't null.
PLS-00306: wrong number or types of arguments in call to 'IMSP_STATE_EDIT'
How would i insert the CLOB field if say I want it to be equal to 'I want to insert info here'. Is there a certain format for this?? I am using Oracle 8.1.7
null

Hi,
sorry for my english I'm french.
I have the same problem of you. I can put file into my long raw. I use SQL odbc function like sqlputdata and sqlgetdata. I know that you use an other method, but I think if we help us, perhaps there is easiear.
So if you want you can mailto
[email protected]
thanks
xav

Similar Messages

  • Problem with comparion of clobs in stored procedure

    Hi ,
    i have a stored procedure which involves a clob variable and a string comparison.
    Below is my procedure
    CREATE OR REPLACE PROCEDURE TEMP_SP (
    empId IN VARCHAR2)
    IS
    tempStr CLOB :='Hello';
    finalStr CLOB :='world';
    BEGIN
    IF finalStr = 'xxx' THEN
    tempStr := ' ';
    finalStr := finalStr || empId;
    END IF;
    IF trim(finalSqltoCur) IS NOT NULL AND tempStr <> ' ' THEN
    finalStr := finalStr || ' and ' || tempStr;
    ELSE
    finalStr := finalStr || tempStr;
    END IF;
    dbms_output.put_line('=========final string value======' || finalStr);
    END TEMP_SP;
    I would like to know why it goes to the else block as tempStr <> ' ' will be true
    and trim(finalSqltoCur) IS NOT NULL also results as true.
    It would be great if some one could help me with this.
    Regards
    Shyam

    > trim(finalStr) IS NOT NULL AND tempStr <> ' '
    And this is (TRUE AND TRUE) and evaluates to TRUE - which means the ELSE block will not be executed,
    SQL> declare
    2 empId number := 123;
    3 tempStr CLOB :='Hello';
    4 finalStr CLOB :='world';
    5 begin
    6 IF finalStr = 'xxx' THEN
    7 tempStr := ' ';
    8 finalStr := finalStr || empId;
    9 END IF;
    10
    11
    12 IF trim(finalStr) IS NOT NULL AND tempStr <> ' ' THEN
    13 finalStr := finalStr || ' and ' || tempStr;
    14 ELSE
    15 finalStr := finalStr || tempStr;
    16 END IF;
    17
    18 DBMS_OUTPUT.put_line('=========final string value======' || finalStr);
    19 end;
    20 /
    =========final string value======world and Hello
    PL/SQL procedure successfully completed.
    SQL>
    Tested on Oracle 10.2.0.1.

  • Write CLOB in stored procedure from a passed Long over 4k

    Hi,
    I have a requirement to write a CLOB into a table as part of a stored procedure. The data to be written is passed in as a long to avoid any maximum size issues. Previously I was able to simple insert the LONG into the column which was a CLOB with no problem however we had a patch applied to out 8.1.6 database which now does not let the procedure and complains of a bad type.
    To work around this I have attempted to instead convert the LONG into a temporary CLOB and write the CLOB (below is basically what it does):
    CREATE PROCEDURE WRITE CLOB (data IN long)
    IS
    v_lob_add CLOB;
    v_size integer;
    BEGIN
    dbms_lob.CREATETEMPORARY(v_lob_add,true,dbms_lob.call);
    select vsize(data) into v_size from dual;
    dbms_lob.WRITE(v_lob_add,v_size,1,pi_add);
    insert into tab1 values (v_lob_add);
    END ADD_LONG2LOB;
    This works fine unless the LONG is over 4001 as this causes the 'select vsize(..' to fail with an 'unreasonable conversion' error.
    My question is:
    1, How can you get the length of a long if its over 4000
    2, Can dbms_lob.WRITE be passed a length over 4000
    3, If none of the above how can a LONG be converted to a CLOB for insertion
    4, Is it a bug that I can't just insert the LONG into the CLOB column (which I could do before this patch was installed 2 days ago!).
    Many thanks for your time.
    John

    Worked out how to get LONG length so just for anyones interest the following works fine:
    PROCEDURE INSERT_INCOMING2(
    chr_MMS_REF IN CHAR,
    chr_NATIVE_MSG IN LONG,
    ) IS
    v_lob2 CLOB;
    v_size integer;
    y varchar2(100);
    BEGIN
    dbms_lob.CREATETEMPORARY(v_lob2,true,dbms_lob.call);
    v_size :=0;
    loop
    y := substr(chr_NATIVE_MSG,v_size,100);
    exit when y is null;
    v_size := v_size + length(y);
    end loop;
    v_size:=v_size-1;
    dbms_lob.WRITE(v_lob2, v_size,1, chr_NATIVE_MSG);
    INSERT INTO INCOMING (MMS_REF, NATIVE_MSG) VALUES(
    chr_MMS_REF,
    v_lob2,);
    END INSERT_INCOMING2;

  • How to get CLOB from stored procedure via StoredProcedureCall

    hi all
    I got "sp" on server : procedure get_text(p_in in varchar2, o_list out clob);
    in code:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("get_text");
    call.addNamedArgumentValue("p_in", new String("MyList"));
    call.addNamedOutputArgument("o_list"); // <- out CLOB
    Vector v = (Vector)this.m_UnitOfWorkt.executeSelectingCall( call ); // <- here I got error
    but if o_list is varchar is all ok
    so how to get data from clob?
    Please help
    Regards
    Krzysztof

    Post Author: achaithanya
    CA Forum: Data Connectivity and SQL
    I'm connecting to database through stored procedure only.We have sybase installed on our local system so that we are given permissions only to access the stored procedures.When u see the fields in CR XI i.e Field explorer you are able to see only 1st result fileds.I connected to sybase and there i'm able to see the output of 1st & 2nd Result set.
    Regards,
    Chaithanya.

  • Parsing XML passed as CLOBs to stored procedures

    I am a newbie using XML with PL/SQL. I would like to pass XML as a CLOB to a stored procedure, parse the nodes in a loop and insert or update records. Something like this:
    The xml:
    <emps>
    <emp>
    <empno>7369</empno>
    <ename>SMITH</ename>
    </emp>
    <emp>
    <empno>7499</empno>
    <ename>ALLEN</ename>
    </emp>
    </emps>
    In the stored procedure:
    CREATE update_emps( xmlCLob in CLOB )
    begin
    load xmlClob into parser p
    nodelist = p.someMethod( '/emps/emp' )
    for each node in nodelist
    insert into emp( empno, ename) values ( node.empno, node.ename
    end loop
    cleanup
    end
    Any assistance you could provide would be greatly appreciated.
    TIA

    If the file size is not large, it seems easier to use XSLT to transform the doc and using XSU to do the updates.

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

  • 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

  • Calling a stored procedure with a CLOB as input parameter

    Hello,
    I was unsuccessfully trying to call a stored procedure with a clob as input parameter from my C++ application using occi.
    Anyone got a working example to look at?
    I already checked the thread Invalid OCI handle when creating a Blob which didn't help.
    The problem seems to be that I don't have a lob locator to write my data (xml file) to. I tried creating a temporary clob using the sys.dbms_lob package which only resulted in a major headache on my part...
    I would appreciate any help.
    Kind regards
    Horst
    my environment:
    Visual Studio 2008, C++ application
    Oracle 11g

    To start using a blob you have to insert it into the database and then get it back. Sounds weird but that is how it is. Here is a very simple program to do this:
    #include<occi.h>
    #include <iostream>
    using namespace oracle::occi;
    using namespace std;
    int main()
      try
        Environment *env = Environment::createEnvironment(Environment::OBJECT);
        Connection *conn = env->createConnection("hr","hr","");
        string stmt1 = "insert into blob_tab values (:1) ";
        string stmt2 = "select col1 from blob_tab";
        Blob blob(conn);
        blob.setEmpty(conn);
        Statement *stmtObj = conn->createStatement(stmt1);
        stmtObj->setBlob(1,blob);
        stmtObj->executeUpdate();
        conn->commit();
        Blob blob1(conn);
        Statement *stmtObj2 = conn->createStatement(stmt2);
        ResultSet *rs = stmtObj2->executeQuery();
        while(rs->next())
         blob1 = rs->getBlob(1);
        string stmt3 = "begin my_proc(:1) ;end;";
        Statement *stmtObj3 =  conn->createStatement(stmt3);
        stmtObj3->setBlob(1,blob1);
        stmtObj3->executeUpdate();
      catch (SQLException e)
        cout << e.getMessage();
      /* The tables and procedure are primitive but ok for demo
        create table blob_tab(col1 blob);
        create or replace procedure my_proc(arg in blob)
        as
        begin
         -- just a putline here. you can do other more meaningful operations with the blob here
          dbms_output.put_line('hello');
       end;
    }Hope this helps.
    Thanks,
    Sumit

  • Calling Stored Procedure with CLOB parameter

    Hi,
    i have one procedure with IN parameter CLOB which is taking xml file and stored in one table column and this table column datatype is also CLOB. And this procedure called by .Net program but problem is when the file will come more than 32KB calling procedure failed. But as i know CLOB can stored up to 4GB data.
    Is that Limitation of oracle or .Net version
    please let me know the solution for that,
    Create Procedure Insert_File(P_XMLFILE IN CLOB)
    as
    begin
    insert into instances
    values(p_xmlfile);
    commit;
    end;
    regards,
    Madan

    Hi Thanks for your reply,
    Actually this procedure called by .net program and the XML file has passed in that parameter which come from some FTP(its inbound) and this files we are storing into above mentioned table.
    Error has come while calling stored procedure Through .net
    Error Details:
    Error calling stored procedure. 0 retry attemps has failed. Error: System.Exception: Error while calling stored procedure on Oracle: INSERT_FILE: System.Data.OracleClient.OracleException: ORA-01460: unimplemented or unreasonable conversion requested

  • Inserting to a clob field using cx_Oracle via a stored procedure

    Hello,
    Does anyone have experience using cx_Oracle to call a stored procedure which inserts to a clob field? I have found examples of doing this via straight SQL but I was hoping it was possible to do this via a stored procedure call. Thanks for any help you can provide.
    Jason

    And cursor.callproc('insert_clob_proc', (clob,))
    doesn't work for you?
    PrzemekYes - I should have been more clear in my original post. The callproc function works until we have a value which is over 32K. At values over 32K, we get an error message "ORA-01460: unimplemented or unreasonable conversion requested". I believe this is because we are sending the value as a string and so we would need to figure out how to send as a CLOB in cx_Oracle? Here is some code to use to test if interested...
    Oracle (Oracle Database 10g Release 10.1.0.4.0 - Production):
    CREATE TABLE clob_test (CLOB_FIELD CLOB);
    CREATE OR REPLACE PROCEDURE ins_clob_test (v_clob_field IN CLOB)
    AS
    BEGIN
    INSERT INTO clob_test (clob_field) VALUES (v_clob_field);
    END ins_clob_test;
    Python (2.5):
    conn = cx_Oracle.connect(xhash['oraclelogin'])
    cursor = conn.cursor()
    clob_var = 'Some test data' * 10000
    cursor.callproc('ins_clob_test',(clob_var,))
    conn.commit()
    cursor.close()
    conn.close()
    I should also mention that I am the Oracle developer and not the Python programmer - my knowledge of Python is very limited. I would like the Python programmers to use the procedures (packages) I have created to do their inserts but this situation has caused them to put the SQL directly in their code.
    Thanks again for any assistance you can provide.
    Jason

  • Stored procedure - insert clob obj - error msg: ORA-01460: unimplemented

    Hi all,
    I have a situation where I want to insert a clob object to my local table via a stored procedure. The clob object stores large amount of text. The clob data is populated from retrieving content in an external text file. When executing an insert statement in c# code, the information was inserted successfully. when executing the stored procedure to insert the information, i always get "ORA-01460: unimplemented or unreasonable conversion requested". I use ReadToEnd() from StreamReader class to retrieve the context of the external text file. Does anyone know why Oracle behaves this way? Thanks for helping in advance.
    TABLE DEFINITION FOR CLOB_TEST
    Name       Type         Nullable Default Comments
    PKG_NAME   VARCHAR2(50) Y                        
    PKG_DESC   CLOB         Y                        
    PKG_FAM_ID NUMBER       Y                        
    STORED PROCEDURE
    procedure InsertTempReleaseTable(p_name        in varchar2,
                                       p_description in clob,
                                       p_fam_id      number) is
      begin
        insert into clob_test
          (pkg_name, pkg_desc, pkg_fam_id)
        values
          (p_name, p_description, p_fam_id);
      end InsertTempReleaseTable;
    RETRIEVE CONTENT FROM A TEXT FILE
    public string GetTextFileContents(string path)
                using (StreamReader sr = new StreamReader(path))
                      return (sr.ReadToEnd());
    C# INVOKE STORED PROCEDURE TO INSERT
    using (OracleCommand cmd = (OracleCommand)database.GetStoredProcCommand("pkg_sptbuildstatus.InsertTempReleaseTable"))
                    cmd.Parameters.Add("p_name", OracleType.VarChar, 255).Value = obj.PackageName;  // string  
                    cmd.Parameters.Add("p_description", OracleType.Clob).Value = obj.ChangeDescription; // string
                    cmd.Parameters.Add("p_fam_id", OracleType.Number).Value = obj.FamilyId; // int
                    database.ExecuteNonQuery(cmd);
                }Edited by: user8976335 on Jan 11, 2010 4:28 PM
    Edited by: user8976335 on Jan 11, 2010 4:59 PM
    Edited by: user8976335 on Jan 11, 2010 4:59 PM
    Edited by: user8976335 on Jan 12, 2010 10:48 AM

    It's possible it doesn't like the name of your variables (being the same as the table), it's good practice to not do that.
    Much better would be.
    procedure InsertTempReleaseTable
       p_name in varchar2,
       p_description in clob,
       p_fam_id number
    is
    begin
       insert into clob_test
          (name, description, fam_id)
       values
          (p_name, p_description, p_fam_id);
    end InsertTempReleaseTable;Your Oracle version is typically of immense help.
    select * from v$version;Also, using the tags will keep the formatting of your code.
    If this isn't any help, can you post a working example of your example ? Where the code breaks (which call).
    Edited by: Tubby on Jan 11, 2010 3:50 PM
    Edited by: Tubby on Jan 11, 2010 3:51 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to call CLOB to BLOB conversion function within stored procedure?

    I have a tiny APEX application from which I need to be able to print. I’ve used these two resources: (Is there an inexpensive APEX report printer for invoices/checks/statements? and http://download.oracle.com/docs/cd/E14373_01/appdev.32/e13363/up_dn_files.htm#CJAHDJDA)
    I guess that in order to be able to download the RTF document stored in CLOB, I need to convert it into BLOB. I’ve found this function for this purpose on Oracle forums:
    CREATE OR REPLACE FUNCTION     c2b( c IN CLOB ) RETURN BLOB
    -- typecasts CLOB to BLOB (binary conversion)
    IS
              pos PLS_INTEGER := 1;
              buffer RAW( 32767 );
              res BLOB;
              lob_len PLS_INTEGER := DBMS_LOB.getLength( c );
    BEGIN
         DBMS_LOB.createTemporary( res, TRUE );
         DBMS_LOB.OPEN( res, DBMS_LOB.LOB_ReadWrite );
    LOOP
         buffer := UTL_RAW.cast_to_raw( DBMS_LOB.SUBSTR( c, 16000, pos ) );
         IF          UTL_RAW.LENGTH( buffer ) > 0
         THEN
                   DBMS_LOB.writeAppend( res, UTL_RAW.LENGTH( buffer ), buffer );
         END IF;
         pos := pos + 16000;
         EXIT WHEN pos > lob_len;
    END LOOP;
    RETURN res; -- res is OPEN here
    END c2b;And I am trying to use it in the modified download procedure that I also have found on Oracle forums:
    CREATE OR REPLACE PROCEDURE DOWNLOAD_WO(v_id IN NUMBER)
    AS
            v_mime          VARCHAR2(48);
            v_length     NUMBER;
            v_file_name     VARCHAR2(2000):= 'WO_Download.rtf';
            lob_loc          CLOB;
              v_blob      BLOB;
              v_company        jobs_vw.company%TYPE;
              v_project        jobs_vw.project%TYPE;
              v_description     jobs_vw.description%TYPE;
              v_date_          jobs_vw.date_%TYPE;
              v_job_no          jobs_vw.job_no%TYPE;
              v_apqwo               jobs_vw.apqwo%TYPE;
    --          v_mime           VARCHAR2(48) := 'application/msword';
    BEGIN
            SELECT     mime_type, report, DBMS_LOB.GETLENGTH(report)
              INTO     v_mime,lob_loc,v_length
              FROM     report_layouts
              WHERE     rl_id = 22332925279634283;
    -- JOB_VW record:
        SELECT     job_no
                   ,date_
                   ,description
                   ,apqwo
                   ,project
                   ,company       
         INTO     v_job_no
                   ,v_date_
                   ,v_description
                   ,v_apqwo
                   ,v_project
                   ,v_company
         FROM     jobs_vw
         WHERE     id = 214;
    -- Replace holders with actual values:
        lob_loc := REPLACE(lob_loc, '#COMPANY#', v_company);
        lob_loc := REPLACE(lob_loc, '#PROJECT#', v_project);
        lob_loc := REPLACE(lob_loc, '#DESCRIPTION#', v_description);
        lob_loc := REPLACE(lob_loc, '#DATE_#', TO_CHAR(v_date_, 'DD/MM/YYYY'));
        lob_loc := REPLACE(lob_loc, '#JOB_NO#', v_job_no);
        lob_loc := REPLACE(lob_loc, '#APQWO#', v_apqwo);
                  -- set up HTTP header
                        -- use an NVL around the mime type and
                        -- if it is a null set it to application/octect
                        -- application/octect may launch a download window from windows
                        owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
                    -- set the size so the browser knows how much to download
                    htp.p('Content-length: ' || v_length);
                    -- the filename will be used by the browser if the users does a save as
                    htp.p('Content-Disposition:  attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
                    -- close the headers           
                    owa_util.http_header_close;
                    -- download the BLOB
    --                wpg_docload.download_file( Lob_loc );
                             v_blob := c2b(lob_loc);
                             wpg_docload.download_file( v_blob );
    end DOWNLOAD_WO;
    /Unfortunately when I try to compile the download_wo stored procedure I am getting this error:
    Error at line 64: PL/SQL: Statement ignoredThe 64th line is:
    v_blob := c2b(lob_loc);How should I correctly call c2b within download_wo? Any advice is greatly appreciated.
    Thank you for your time.
    Daniel

    Hello there,
    Well, its invalid :(
    Object C2B is Invalid. I didn't know since when I run the create ... function, I only get this feedback:
    Statement processed.
    0.19 secondsI am investigating.
    Daniel

  • Java Stored Procedures, CLOB parameter

    Hi all
    I need to return s String parameter from a Java Stored Procedure but it is longer than 32000 chars, so I can4t use VARCHAR2 to publish it. I call that procedure from App. Server with JDBC.
    I want to return a CLOB but I don4t know how to publish it, as I can4t do it from the deploy wizard.
    Thank a lot!
    Jose R.

    If you grant the right privileges to the user executing them..
    (See the java developer guide for the details).
    Note that calls to the OS through System.getRuntime().execxxx will run as the oracle user on the server side, that's why you have to be able to grant the right privileges before doing it.

  • Oracle Stored Procedure [CLOB out] - ASP

    I am executing a stored procedure via ASP and getting a CLOB field back. It fails for big CLOBs (more then 4000 chars)..[Oracle][ODBC][Ora]ORA-06502: PL/SQL: numeric or value error ORA-06512: at line 1 .
    My code:
    Set conn = server.createobject("ADODB.connection")
    conn.Open StrConn
    Set comm = Server.CreateObject("ADODB.Command")
    Set param = Server.CreateObject("ADODB.Parameter")
    Set comm.ActiveConnection=conn
    comm.CommandType=1
         'run stored procedure
         'var tpsid NUMBER;
         'var viewType varchar2(3);
         'var format varchar2(5);
    'var tcNum NUMBER;
    'var tpshtml CLOB;
         'execute dbdev.tps_section.tps_html_gen(:tpshtml, :tpsid, :viewType, :format, :tcNum);
    strSQL="{ call dbdev.tps_section.tps_html_gen(?, "&tpsid&", '"&ViewType&"', '"&format&"', "&tpstcm&", "& tpsverid &") }"
    comm.CommandText =strSQL
    set param = comm.CreateParameter(":tps_html",adLongVarWChar,adParamOutput,100000,"")
    comm.Parameters.Append param
    comm.Properties(0) = TRUE
    comm.Execute
    response.Write comm.Parameters(0).Value
    My second attempt was to use OO4O but it doesn't seem to get the bind vaiable back.
    const ORATYPE_CLOB=112
    Set OraSession = Server.CreateObject("OracleInProcServer.XOraSession")
    Set OraDatabase = OraSession.DbOpenDatabase("test200", "guest/guest",cint(0))
    OraDatabase.Parameters.Add "OutVar", OutVar, ORAPARM_OUTPUT
    OraDatabase.Parameters("OutVar").ServerType = ORATYPE_CLOB
    strSQL="call dbdev.tps_section.tps_html_gen(:tps_html, "&tpsid&", '"&ViewType&"', '"&format&"', "&tpstcm&", "& tpsverid &")"
    Set OraSQLStmt=OraDatabase.CreateSql(strSQL, ORASQL_FAILEXEC)
    response.Write OraDatabase.Parameters("tps_html").Value
    Please Help!

    I am executing a stored procedure via ASP and getting a CLOB field back. It fails for big CLOBs (more then 4000 chars)..[Oracle][ODBC][Ora]ORA-06502: PL/SQL: numeric or value error ORA-06512: at line 1 .
    My code:
    Set conn = server.createobject("ADODB.connection")
    conn.Open StrConn
    Set comm = Server.CreateObject("ADODB.Command")
    Set param = Server.CreateObject("ADODB.Parameter")
    Set comm.ActiveConnection=conn
    comm.CommandType=1
         'run stored procedure
         'var tpsid NUMBER;
         'var viewType varchar2(3);
         'var format varchar2(5);
    'var tcNum NUMBER;
    'var tpshtml CLOB;
         'execute dbdev.tps_section.tps_html_gen(:tpshtml, :tpsid, :viewType, :format, :tcNum);
    strSQL="{ call dbdev.tps_section.tps_html_gen(?, "&tpsid&", '"&ViewType&"', '"&format&"', "&tpstcm&", "& tpsverid &") }"
    comm.CommandText =strSQL
    set param = comm.CreateParameter(":tps_html",adLongVarWChar,adParamOutput,100000,"")
    comm.Parameters.Append param
    comm.Properties(0) = TRUE
    comm.Execute
    response.Write comm.Parameters(0).Value
    My second attempt was to use OO4O but it doesn't seem to get the bind vaiable back.
    const ORATYPE_CLOB=112
    Set OraSession = Server.CreateObject("OracleInProcServer.XOraSession")
    Set OraDatabase = OraSession.DbOpenDatabase("test200", "guest/guest",cint(0))
    OraDatabase.Parameters.Add "OutVar", OutVar, ORAPARM_OUTPUT
    OraDatabase.Parameters("OutVar").ServerType = ORATYPE_CLOB
    strSQL="call dbdev.tps_section.tps_html_gen(:tps_html, "&tpsid&", '"&ViewType&"', '"&format&"', "&tpstcm&", "& tpsverid &")"
    Set OraSQLStmt=OraDatabase.CreateSql(strSQL, ORASQL_FAILEXEC)
    response.Write OraDatabase.Parameters("tps_html").Value
    Please Help!

  • How to get multiple out parameters from a pl/sql stored procedure in ADF Jdeveloper 11g release2

    I´m trying to call from AppModuleImpl a stored procedure from my oracle DB which receives one input parameter and returns 5 out parameters. 
    I´m using jdeveloper 11g release2  ADF and I have created a java bean "ProRecallPlatesBean " with the atributes and accesors and I serialize it. just like in this article http://docs.oracle.com/cd/E24382_01/web.1112/e16182/bcadvgen.htm#sm0297
    This is my code so far:
    public ProRecallPlatesBean getCallProRecallPlates(String numPlates) {
    CallableStatement st = null;
    try {
              // 1. Define the PL/SQL block for the statement to invoke
              String stmt = "begin CTS.Pk_PreIn.proRecallPlates(?,?,?,?,?,?); end;";
              // 2. Create the CallableStatement for the PL/SQL block
              st = getDBTransaction().createCallableStatement(stmt,0);
              // 3. Register the positions and types of the OUT parameters
              st.registerOutParameter(2,Types.VARCHAR);
    st.registerOutParameter(3,Types.VARCHAR);
    st.registerOutParameter(4,Types.VARCHAR);
    st.registerOutParameter(5,Types.VARCHAR);
    st.registerOutParameter(6,Types.VARCHAR);
    // 4. Set the bind values of the IN parameters
    st.setString(1,numPlates);
    // 5. Execute the statement
    st.executeUpdate();
    // 6. Create a bean to hold the multiple return values
    ProRecallPlatesBean result = new ProRecallPlatesBean();
    // 7. Set values of properties using OUT params
    result.setSpfVal(st.getString(2));
    result.setTransportTypeVal(st.getString(3));
    result.setTransportCompanyVal(st.getString(4));
    result.setCompanyDescrVal(st.getString(5));
    result.setDGAPrint(st.getString(6));
    // 8. Return the result
    return result;
    } catch (SQLException e) {
    throw new JboException(e);
    } finally {
    if (st != null) {
    try {
    // 9. Close the JDBC CallableStatement
    st.close();
    catch (SQLException e) {}
    In Jdeveloper I went into AppModule.xml JAVA>Client Interface section and expose "getCallProRecallPlates" Then I can see "getCallProRecallPlates" in Data Controls, I drag and drop it to a JSF page, an input text component and a button are generated in order to put in there the procedure input parameter (numPlates).
    I don't know if I'm on the right track.
    When I click the button, the "result" variable is supposed to be filled with data from the stored procedure. I want each of those values to be displayed in Output text or input text adf components but I dont know how. Thank you very much in advance I´m a newbie and i'll appreciate your help!

    What version are you on?
    Works fine for me on my 11g:
    SQL> create or replace procedure testxml (clob_out out clob)
      2  is
      3     l_clob   clob;
      4     l_ctx    dbms_xmlquery.ctxhandle;
      5  begin
      6     l_ctx := dbms_xmlquery.newcontext ('select * from dual');
      7     l_clob := dbms_xmlquery.getxml (l_ctx);
      8     clob_out := l_clob;
      9     dbms_xmlquery.closecontext (l_ctx);
    10  end testxml;
    11  /
    Procedure created.
    SQL>
    SQL> variable vout clob;
    SQL>
    SQL> exec testxml (:vout)
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print vout
    VOUT
    <?xml version = '1.0'?>
    <ROWSET>
       <ROW num="1">
          <DUMMY>X</DUMMY>
       </ROW>
    </ROWSET>But definitely you can optimize your proc a bit: Try
    create or replace procedure testxml (clob_out in out nocopy clob)
    is
       l_ctx    dbms_xmlquery.ctxhandle;
    begin
       l_ctx := dbms_xmlquery.newcontext ('select * from dual');
       clob_out := dbms_xmlquery.getxml (l_ctx);
       dbms_xmlquery.closecontext (l_ctx);
    end testxml;
    /

Maybe you are looking for

  • How to change email address on iCloud

    My email address was hacked into so I had to change it. Which caused me to change my apple ID also. Now I am not sure how to change my email address on Icloud. It still show my old apple ID. Do I have to delete the whole account an start it over? Not

  • Can i  view a list apps that were purchased from shared account

    can i reveiw a list of apps that were purchased from shared account

  • Converting a MS Access Query to Oracle SQL

    Hi, We have a large number of MS Access (2000) queries (mostly select queries -Some containing sub queries-) that need to be converted to Oracle's syntax to be used on our intranet instead of the existing Access frontend. Do you know of a tool that c

  • Do we have any API / Interface to create Inventory and subinventory...?

    Hello, I am trying to find out API/ Interface to create Inventory and sub inventory. I tried to search lot but I didn't got that. Could you please help me for that. Thanks, Ravi Raj

  • Random volume changes!

    Hi, The volume on certain tracks suddenly change without automation being present on the track... I've even caught the volume changing slightly and quickly while nothing is playing. (ie. track 13 for example would quickly be jumping from -6.1 to -2.4