How to return less than 4000 characters from pl/sql function in SQL call?

Hello,
Is there a way to limit length for varchar when calling pl/sql function from SQL? No matter how I write it it always returns 4000 bytes.
If there is none, then does it make sense ever to specify lenght of the return variable?
My goal is to encapsulate business rules within pl/sql functions. But if all varchar columns are returned as 4000 it is not feasible solution. Not only this is a performance issue in a data warehousing environment, bet when using those rules within SQL views user experiance would suffer as well. Are we left with the rule hardcoding solution? Also, I think that using SUBSTRING or TRUNC functions on top of business rules function defeats the purpose.
Please see my attempt below. Your thoughts are appreciated.
Thank you.
/* Formatted on 06/11/2009 2:26:41 PM (QP5 v5.126.903.23003) */
CREATE OR REPLACE FUNCTION mytest (myvar_in VARCHAR2)
RETURN VARCHAR2
AS
l_return VARCHAR2 (15);
BEGIN
l_return := 'TEST_' || myvar_in;
RETURN l_return;
END mytest;
CREATE TABLE TEST_ME
AS
SELECT mytest ('ME') AS VERYLONG FROM DUAL;
describe TEST_ME;
RUN ABOVE CODE:
Function created.
Table created.
TABLE TEST_ME
Name Null? Type
VERYLONG VARCHAR2(4000)
Edited by: Ilmars2 on Jun 11, 2009 2:46 PM

Pointless,
Thanks for jumping in on this and I am glad you asked :).
I do not doubt that it is an architectural challenge. Otherwise it would have been done already! I am struggling with the fact that SQL knows what data type the function will return, but does not know the length of it, precision or scale. I will leave it at that.
I will go with some high level requirements to allow for alternative thoughts:
1)     Business defined rules. There are multiple types of business rules. Simple lookups, bucketing, complex calculations, data retrieved from other tables etc. We have about 500 different rules. Some of them are even overloaded – different inputs will produce the same output.
Some simple examples are:
Rule1 - Fruit
     when ‘A’ then ‘Apple’
     When ‘O’ then ‘Orange’
     Else ‘N/A’ end
Rule2 – Bonus
     when STATUS =’Active’ and LEVEL=’CEO’ then bonus=salary*1.0
     when STATUS =’Active’ and LEVEL=’nobody’ then bonus=salary*0.01
     else bonus=0
Rule 3 – Income Bracket
     When more than 0 and less or equal to 30000 then INC_B=’LOW’
     When more than 30000 and less of equal to 60000 then INC_B=’MIDDLE’
Etc.
2)     Challenge: All data users in an organization need to use the same rules (let’s assume data source is Oracle database). How to expose all the rules to different types of users in manageable way? Types of users – analysts, application/web developers, data warehouse teams etc.
3)     Current system: Not only each user has coded their own rules (luckily based on the common specification), but hard-coding is taking place for each query within the confines of one project. The project I just looked at had about 12 modules with 30 hardcoded queries. Oops! Few rules just changed.
My take: I was leaning toward encapsulating business logic within UDF’s. UDF’s provide all the flexibility we need + overloading. All the functions could be consumed by data warehouse team (building summary tables, cubes etc.) and application developers. For power users we could build views by applying the same functions on top of the source data. Thus avoid data duplication. It seemed win-win until this 4000 issue :).
Your thoughts on alternative approaches are appreciated.
Thank you.

Similar Messages

  • How to return more than one value from a  function

    hello everybody,
    Can anyone tell me how to return more than a single value from a function, the problem is i have 4 points,
    2 points form one line ,another 2 points form 2nd line ,each point is 3 dimensional(x,y,z coorinates) so i will pass these values to func(x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4), i will find the point of intersecton of two lines and i will get it as x,y,z , now how to return these 3 coordinates,usually the function returns only one value, please help me to solve it out.
    Thanks.

    I think the easiest way or trick here is (easiest isn't always the best as we know, but atleast this one will work) to create simple data array. and pass that. Create an array with:
    <code>
    class justArray {
    int x=0
    int y=0;
    int z= 0;
    ...somewhere
    justArray[] points= new justArray[4];
    points[0].x= ..
    points[0].y= ..
    points[0].z= ..
    points[1].x= ..
    return points[]
    </code>

  • FUNCTION returning more than 4000 characters

    I am calling the below function from a view, and function is failing because it returning more than 4000chars.
    An I know when the return type is varchar2 it cannot return more than 4000 chars.
    It's working fine when I use CLOB for the return type. Is there any other better option to handle this err.
    CREATE OR REPLACE FUNCTION FN_CONCATENATE_COMMENTS (
    P_CASENO IN PATIENT_DET.CASE_NO%TYPE,
    P_POLICY IN PATIENT_DET.POLICYNO%TYPE
    RETURN VARCHAR2
    AS
    V_TEMP VARCHAR2(300);
    V_COMMENT VARCHAR2(30000);
    CURSOR FETCHCOMMENT IS
    SELECT TO_CHAR (C.CREATED_TS,'mm/dd/yyyy hh:mi:ss AM - ')|| C.DOC_COMMENT_DESC DOC_COMMENT_DESC
    FROM TREATEMENT_DET C
    WHERE C.CASE_CD = P_CASENO AND C.POLICY_N0 = P_POLICY
    ORDER BY C.CREATED_TS ;
    BEGIN
    OPEN FETCHCOMMENT;
    LOOP
    FETCH FETCHCOMMENT INTO V_TEMP;
    EXIT WHEN FETCHCOMMENT%NOTFOUND;
    V_COMMENT := V_COMMENT ||' '|| TRIM(V_TEMP) ||' ';
    END LOOP;
    CLOSE FETCHCOMMENT;
    RETURN V_COMMENT;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.PUT_LINE('SYSTEM ERROR PLEASE CONTACT DBA ' || SQLERRM);
    END FN_CONCATENATE_COMMENTS;

    HI
    Welcome to the forum!
    try this please.
    -- IT IS NOT TESTED --
    CREATE OR REPLACE FUNCTION FN_CONCATENATE_COMMENTS (
    P_CASENO IN PATIENT_DET.CASE_NO%TYPE,
    P_POLICY IN PATIENT_DET.POLICYNO%TYPE
    RETURN VARCHAR2
    AS
    V_TEMP VARCHAR2(300);
    V_COMMENT CLOB;
    CURSOR FETCHCOMMENT IS
    SELECT TO_CHAR (C.CREATED_TS,'mm/dd/yyyy hh:mi:ss AM - ')|| C.DOC_COMMENT_DESC DOC_COMMENT_DESC
    FROM TREATEMENT_DET C
    WHERE C.CASE_CD = P_CASENO AND C.POLICY_N0 = P_POLICY
    ORDER BY C.CREATED_TS ;
    BEGIN
    OPEN FETCHCOMMENT;
    LOOP
    FETCH FETCHCOMMENT INTO V_TEMP;
    EXIT WHEN FETCHCOMMENT%NOTFOUND;
    V_COMMENT := V_COMMENT ||' '|| TRIM(V_TEMP) ||' ';
    END LOOP;
    CLOSE FETCHCOMMENT;
    RETURN DBMS_LOB.SUBSTR(V_COMMENT ,32000,1);
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.PUT_LINE('SYSTEM ERROR PLEASE CONTACT DBA ' || SQLERRM);
    END FN_CONCATENATE_COMMENTS;Edited by: Mahir M. Quluzade on Apr 22, 2011 1:45 PM
    Edited by: Mahir M. Quluzade on Apr 22, 2011 1:46 PM

  • How to store more than 4000 characters in a table

    I have a requirement to store 4000+ character string in the table. CLOB and BLOB does not allow me as it has limitations of 4000 characters.
    Any suggestions please.

    declare
    l clob;
    begin
    l:= '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111';
    update table_name
    set column_name = l;
    commit;
    end;
    This works fine.
    We are using Pentaho to insert records so using pl/sql is not appropriate.

  • How to return more than one object from SwingWorker

    I am using a SwingWorker to call 3 different methods of another class (data fetch class). Each of these 3 methods returns a String array. I am able to get the first array outside the thread code using the get() method of the SwingWorker class,
    final String tmpOrdNum = OrderNum;
    SwingWorker worker = new SwingWorker() {
         DATA_FETCH_TO_ARRAY data_fetch = new DATA_FETCH_TO_ARRAY(tmpOrdNum);
         public Object construct(){
              String [] orderArr = data_fetch.getHeaderArray();
              //String [] detailArr = data_fetch.getDetailArray();
              //String [] storeArr = data_fetch.getStoreArray();                    
              return orderArr;
         //Runs on the event-dispatching thread.
         public void finished(){     }
    worker.start() ;
    String[] testArr = (String[])worker.get();      //gets the header array
    /* HOW DO I GET THE DETAIL AND STORE ARRAYS HERE?*/I want to be able to call the other 2 methods of the data fetch class - getDetailArray() and getStoreArray() shown commented in the above code one by one.
    Can someone please suggest a way of doing this? Thank you.

    Return String[][] from construct method.
    Here is an example (observe test method):
    import java.util.*;
    public class ArrayTest{
         public static void main(String[] args){
              String[][] result=(String[][])new ArrayTest().test();          
              System.out.println("result1: "+Arrays.toString(result[0]));
              System.out.println("result2: "+Arrays.toString(result[1]));
              System.out.println("result3: "+Arrays.toString(result[2]));
         public Object test(){
              String[] str1={"A","B","C"};
              String[] str2={"M","N","O"};
              String[] str3={"X","Y","Z"};          
              String[][] out=new String[3][];
              out[0]=str1;
              out[1]=str2;
              out[2]=str3;
              return out;
    }Thanks,
    Mrityunjoy

  • How to return more than one varibles from a method?

    can you use the codes:
    return var1, var2,var3;
    If not, what is the correct way to do so? thanks.

    You can only return 1 object from a method in Java.
    However, this 1 object can contain multiple other objects. For example, a Vector object:
      public Vector someMethod() {
        Vector v = new Vector();
        v.add("abc");
        v.add("xyz");
        v.add("123");
        return v;
      }If these multiple objects are the same type, you can also use array to achieve want you want.
      public String[] someMethod() {
        String ss = new String[3];
        ss[0] = "abc";
        ss[1] = "xyz";
        ss[2] = "123";
        return ss;
      }--lichu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Selecting the first 4000 characters from a tag in an xml file

    Oracle Enterprise Edition 11.1.0.7 64 bit (Jan 2012 CPU applied)
    Windows 2003 64 bit
    We have an XML file with the following sample format.
    <?xml version="1.0"?>
    <HR>
    <EMP>
    <FNAME>JOHN</FNAME>
    <LNAME>DOE</LNAME>
    <COMMENT>Comment with less than 4000 characters</COMMENT>
    </EMP>
    <EMP>
    <FNAME>JANE</FNAME>
    <LNAME>DOE</LNAME>
    <COMMENT>Comment with more than 4000 characters</COMMENT>
    </EMP>
    </HR>
    The query below
    (full disclosure: which I took from odie_63's response in Creating External Table using Xml Dataset - how to include null values? and added the CURSOR_SHARING_EXACT hint on the top)
    works when the contents of the <Comment> tag are smaller than 4000 characters. If it is more than 4000 I get
    ORA-01706: user function result value was too large
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'COMMENT'
    I found another query where someone was doing a substring (I think to get only the first 4000 characters from the tag) here.
    http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14638197 (See OP's post)
    TERMINATION_DATE VARCHAR(32) path 'TerminateDate/substring(text(), 1, 32)',
    So I updated my query to be
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'COMMENT/substring(text(),1,4000)'
    The query runs without an error when the <comment> tag has 4000 or less characters but still errors out with it is more than 4000.
    I found an alternative method to do the SUBSTRING here in Herald ten Dam's reponse in Re: A view over XML that is not 1:1
    code varchar2(30) path 'substring(code,1,3)',
    so I tried this:
    SELECT /*+ CURSOR_SHARING_EXACT */
    FROM XMLTable(
    '/HR/EMP'
    passing xmltype( bfilename('DATA_PUMP_DIR','emp.xml'), nls_charset_id('CHAR_CS') )
    columns
    first_name varchar2(30) path 'FNAME',
    last_name varchar2(30) path 'LNAME',
    comments varchar2(4000) path 'substring(COMMENT,1,4000)'
    but that doesn't work either.
    How can I extract the first 4000 characters of the <COMMENT> tag so that the query doesn't fail.
    We are not using any other XMLDB features at this time. This is the first we've started looking into using Oracle built in XML features, so we might not have setup something that other's might know to specifically setup to start using the XML features in Oracle 11.1
    Thanks in advance,
    Wally

    walls99 wrote:
    This is regardless of the COMMENTS tag being 4000 characters or more and the same with the ideas from Odie.
    WallyNo idea if it is an issue with your version. I don't have your version to test but following works for me. Does this simple test work?
    SQL> select * from v$version ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> set define off
    SQL> select dbms_xmlgen.convert(xmlserialize(content xmltype('<brand>Ben &amp; Jerry</brand>') as clob), 1) from dual ;
    DBMS_XMLGEN.CONVERT(XMLSERIALIZE(CONTENTXMLTYPE('<BRAND>BEN&AMP;JERRY</BRAND>')A
    <brand>Ben & Jerry</brand>

  • Owa_text.vc_arr: can't handle the string with more than 4000 characters?

    In the Oracel Web Application Server 4.0 documment, it says
    about owa_text.vc_arr :Type vc_arr is table of varchar2(32767)
    index by binary_integer.
    I amusing PL_SQL with Oracle8i and OWA4.0 web server.I want to
    use owa_text.vc_arr to pass the multple line texts in my form.
    If the text length is less than 4000 characters, everything works
    fine.However when the texts are longer than 4000 characters but
    less than the max length 32767 characters, I got this error
    message:
    OWS-05101: Execution failed due to Oracle error 2005
    ORA-02005: implicit (-1) length not valid for this bind or define
    datatype.
    Owa_text.vc_arr is supposed to handle the string with more
    than 4000 characters, is it true? Could anyone tell me why? Any
    help will be greatly appreciated!!!
    Thanks very much.
    Helena Wang
    Here is the pl_sql procedure to create my form:
    PROCEDURE myform
    IS
    BEGIN
    htp.p('
    <form action="'||service_path||'helena_test.saveform3"
    method=post>
    <input type=hidden name=tdescription value="X">
    Input1: <textarea name=tdescription rows=50 cols=70
    WRAP=physical></textarea>
    Input2: <textarea name=tdescription rows=50 cols=70
    WRAP=physical></textarea>
    <input type=submit name=WSave value="Save">
    </form>
    END;
    /***** here is the pl_sql procedure which I use to save the
    form***/
    procedure saveform3(tdescription in owa_text.vc_arr,
    WSave in varchar2 default 'No')
    is
    len pls_integer;
    begin
    for i in 2..tdescription.count loop
    len := length(tdescription(i));
    htp.p(len);
    htp.p(tdescription(i));
    end loop;
    end;

    Helena, I think you might get a better response either from the SQL-PL/SQL forum, or perhaps the Portal Applications forum - both of these tend to have folks very familiar with PL/SQL and the OWA packages.
    This forum is on Web services based on SOAP, WSDL and UDDI. These can be PL/SQL based but typically don't use the mod_psql or OWA web solution.
    As a pointer, I suspect you may already be familiar with, but just in case, you can always take a look at chapter 3 of the OAS documentation, "Developer's Guide: PL/SQL and ODBC Applications" where they go through a number of examples using parameters. See:
    http://technet.oracle.com/doc/appsrvr4082/guides/plsql.pdf
    Hope this or folks from the other list can help.
    Mike.

  • Column with more than 4000 characters

    Hi,
    Version: 10.2.0.4.0
    I have a requirement to display more than 4000 characters (clob, long data type) through sql.
    Though this can be achieved through pl/sql, I am not able to get the output in sql statements. Is it possible to get this done through sql?
    I can use intermediate pl/sql processing if needed.
    Thanks for your help.

    Preta wrote:
    Though this can be achieved through pl/sql, I am not able to get the output in sql statements. Is it possible to get this done through sql?Yes, what did you try? - Hopefully not LONG
    SQL> drop table t purge;
    Table dropped.
    SQL> create table t (c clob);
    Table created.
    SQL> insert into t values (rpad(to_clob('x'),4001, 'x'));
    1 row created.
    SQL> set long 5000
    SQL> set pages 100
    SQL> select c from t;
    C
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    x
    SQL>Regards
    Peter

  • Why can't  owa_text.vc_arr  handle the string with more than 4000 characters?

    I am using PL_SQL with Oracle8i and OAS 4.0 web server.I want to
    use owa_text.vc_arr to pass the inputs in serval text areas in the form on a web application.
    If the input string length is less than 4000 characters, everything works fine.However when the strings are longer than 4000 characters but less than the max length 32767 characters, I got this error message:
    OWS-05101: Execution failed due to Oracle error 2005
    ORA-02005: implicit (-1) length not valid for this bind or define datatype.
    In the Oracle Application Server 4.0 documment, it says
    about owa_text.vc_arr :Type vc_arr is table of varchar2(32767)
    index by binary_integer. It means that owa_text.vc_arr can handle multiple strings and each string can have up to 32767 single byte characters, is it right?
    Owa_text.vc_arr is supposed to handle the string with more
    than 4000 characters, is it true? Could anyone tell me why? Any
    help will be greatly appreciated!!!
    Thanks very much.
    Helena Wang
    Here is the pl_sql procedure to create my form on the web:
    PROCEDURE myform
    IS
    BEGIN
    htp.p('
    <form action="'||service_path||'helena_test.saveform3"
    method=post>
    <input type=hidden name=tdescription value="X">
    Input1: <textarea name=tdescription rows=50 cols=70
    WRAP=physical></textarea>
    Input2: <textarea name=tdescription rows=50 cols=70
    WRAP=physical></textarea>
    <input type=submit name=WSave value="Save">
    </form>
    END;
    /***** here is the pl_sql procedure which I use to save the
    form***/
    procedure saveform3(tdescription in owa_text.vc_arr,
    WSave in varchar2 default 'No')
    is
    len pls_integer;
    begin
    for i in 2..tdescription.count loop
    len := length(tdescription(i));
    htp.p(len);
    htp.p(tdescription(i));
    end loop;
    end;

    The maximum size of a VARCHAR2 field in Oracle 8i is 4000 bytes.
    you'll ned to use a LOB type (or LONG if you prefer the old way)

  • ORA-01460 at REPLACE for strings longer than 4000 characters

    the following code works fine for vVar_Value less than 4001 characters but raises an ORA-01460 for strings equal to or larger than 4001 characters in my environments.
    declare
    vVar_Value VARCHAR2(32000) := '';
    begin
    for i in 1..4000 loop
    vVar_Value := vVar_Value||'X';
    end loop;
    dbms_output.Put_Line('length(vVar_Value): '||length(vVar_Value));
    SELECT REPLACE( vVar_Value, 'NO_MIDDLE_NAME', '') INTO vVar_Value FROM DUAL;
    exception
    when others then
    raise;
    end;
    any advice would be most apprectiated.
    thanks in advance.

    Why the heck are you using select from dual?
    Just use vVar_Value := REPLACE( vVar_Value, 'NO_MIDDLE_NAME', ''); and everything will be OK
    in SQL limit for varchar2 is 4K, only in PL/SQL you can use 32K
    Gints Plivna
    http://www.gplivna.eu

  • Need ouput more than 4000 characters

    Hi , how to create a script that fetches more than 4000 charaters in the ouput

    declare your pl/sql variable as varchar2(32767) which is the maximum and then you can select that amount.Not so fast Blu ;)
    SQL>  create or replace function f
    return varchar2
    as
    begin
    return lpad ('x', 32767, 'x');
    end f;
    Function created.
    SQL>  exec dbms_output.put_line(length(f))
    32767
    PL/SQL procedure successfully completed.
    SQL>  select length (f) from dual
    select length (f) from dual
    Error at line 1
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "MICHAEL.F", line 5To SELECT more than 4000 chars you'll always need a CLOB ..

  • Displaying more than 4000 characters

    Hi
    I have a report which would display a CLOB field having text of length around 32000 characters.
    I tried to use DBMS_LOB.SUBSTR(<field_name>,32000,1) on the query so that it shows the text at least till 32000 characters on the report but it keeps returning an error ORA-06502 PL/SQL: numeric or value error string - character string buffer too small whenever it is more than 4000 characters in that particular field.
    Can anyone pls suggest any solution ASAP?
    Thanks
    Arnab

    You can split your clob in varchar2 4000 drop table tab1;
    create table tab1 (
      clsplit_id                   number(10)        NOT NULL,
      clsplit_type1val          CLOB                 NULL,
      clsplit_type2val          CLOB                 NULL
    drop type some_list;
    drop type my_t;
    create type my_t as object
          id1 number,
          clob_type number,
          no_clob_lines      number,
          clob_line      number,
          clob_data      varchar2(80)
    show errors
    create type some_list as table of my_t
    show errors
    insert into tab1 values(1, 'a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789leftover',
          'a9876543210b9876543210c9876543210d9876543210e9876543210f9876543210leftover');
    insert into tab1 values(2, '0aaaaaaaaaa1bbbbbbbbbb2cccccccccc3dddddddddd4eeeeeeeeee5ffffffffff',
          'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    insert into tab1 values(3, 'first has data, second null', null);
    insert into tab1 values(4, null, 'first null second has data');
    insert into tab1 values(5, 'short lob', 'short lob');
    commit;
    create or replace function some_func return some_list pipelined is
          num_allowed_chars      number      := 4000;
          clob1_len                  number;
          clob2_len                  number;
          loop_counter            number;
          col_name                  varchar2(100);
          current_line            number;
          i                              integer;
            out_rec my_t := my_t(NULL,NULL,NULL,NULL,NULL);
    begin
          for c1 in ( select clsplit_id, clsplit_type1val, clsplit_type2val from tab1 )
          loop
                -- get first clob
                if c1.clsplit_type1val is not null then
                      clob1_len := dbms_lob.getlength(c1.clsplit_type1val);
                      if clob1_len > num_allowed_chars then
                            for i in 1..ceil(clob1_len/num_allowed_chars) loop
                                  out_rec.id1 := c1.clsplit_id;
                                  out_rec.clob_type := 1;
                                  out_rec.no_clob_lines := ceil(clob1_len/num_allowed_chars);
                                  out_rec.clob_line := i;
                                  out_rec.clob_data := substr(c1.clsplit_type1val,( i * num_allowed_chars ) - num_allowed_chars + 1,num_allowed_chars);
                                  pipe row(out_rec);
                            end loop;
                      else
                                  out_rec.id1 := c1.clsplit_id;
                                  out_rec.clob_type := 1;
                                  out_rec.no_clob_lines := 1;
                                  out_rec.clob_line := 1;
                                  out_rec.clob_data := c1.clsplit_type1val;
                                  pipe row(out_rec);
                      end if;
                end if;
                -- get second clob
                if c1.clsplit_type2val is not null then
                      clob2_len := dbms_lob.getlength(c1.clsplit_type2val);
                      if clob2_len > num_allowed_chars then
                            for i in 1..ceil(clob2_len/num_allowed_chars) loop
                                  out_rec.id1 := c1.clsplit_id;
                                  out_rec.clob_type := 2;
                                  out_rec.no_clob_lines := ceil(clob2_len/num_allowed_chars);
                                  out_rec.clob_line := i;
                                  out_rec.clob_data := substr(c1.clsplit_type2val,( i * num_allowed_chars ) - num_allowed_chars + 1,num_allowed_chars);
                                  pipe row(out_rec);
                            end loop;
                      else
                                  out_rec.id1 := c1.clsplit_id;
                                  out_rec.clob_type := 2;
                                  out_rec.no_clob_lines := 1;
                                  out_rec.clob_line := 1;
                                  out_rec.clob_data := c1.clsplit_type2val;
                                  pipe row(out_rec);
                      end if;
                end if;
          end loop;
          return;
    end;
    show errors
    select * from
    table(select some_func() from dual)
    order by 1,2,4;

  • SharePoint 2010, Visual Studio 2010, Packaging a solution - The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

    Hi,
    I have a solution that used to contain one SharePoint 2010 project. The project is named along the following lines:
    <Company>.<Product>.SharePoint - let's call it Project1 for future reference. It contains a number of features which have been named according
    to their purpose, some are reasonably long and the paths fairly deep. As far as I am concerned we are using sensible namespaces and these reflect our company policy of "doing things properly".
    I first encountered the following error message when packaging the aforementioned SharePoint project into a wsp:
    "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."
    I went through a great deal of pain in trying to rename the project, shorten feature names and namespaces etc... until I got it working. I then went about gradually
    renaming everything until eventually I had what I started with, and it all worked. So I was none the wiser...not ideal, but I needed to get on and had tight delivery timelines.
    Recently we wanted to add another SharePoint project so that we could move some of our core functinality out into a separate SharePoint solution - e.g. custom workflow
    error logging. So we created another project in Visual Studio called:
    <Company>.<Product>.SharePoint.<Subsystem> - let's call it Project2 for future reference
    And this is when the error has come back and bitten me! The scenario is now as follows:
    1. project1 packages and deploys successfully with long feature names and deep paths.
    2. project2 does not package and has no features in it at all. The project2 name is 13 characters longer than project1
    I am convinced this is a bug with Visual Studio and/or the Package MSBuild target. Why? Let me explain my findings so far:
    1. By doing the following I can get project2 to package
    In Visual Studio 2010 show all files of project2, delete the obj, bin, pkg, pkgobj folders.
    Clean the solution
    Shut down Visual Studio 2010
    Open Visual Studio 2010
    Rebuild the solution
    Package the project2
    et voila the package is generated!
    This demonstrates that the package error message is in fact inaccurate and that it can create the package, it just needs a little help, since Visual Studio seems to
    no longer be hanging onto something.
    Clearly this is fine for a small time project, but try doing this in an environment where we use Continuous Integration, Unit Testing and automatic deployment of SharePoint
    solutions on a Build Server using automated builds.
    2. I have created another project3 which has a ludicrously long name, this packages fine and also has no features contained within it.
    3. I have looked at the length of the path under the pkg folder for project1 and it is large in comparison to the one that is generated for project2, that is when it
    does successfully package using the method outlined in 1. above. This is strange since project1 packages and project2 does not.
    4. If I attempt to add project2 to my command line build using MSBuild then it fails to package and when I then open up Visual Studio and attempt to package project2
    from the Visual Studio UI then it fails with the path too long error message, until I go through the steps outlined in 1. above to get it to package.
    5. DebugView shows nothing useful during the build and packaging of the project.
    6. The error seems to occur in
    CreateSharePointProjectService target called at line 365 of
    Microsoft.VisualStudio.SharePoint.targetsCurrently I am at a loss to work out why this is happening? My next task is to delete
    project2 completely and recreate it and introduce it into my Visual Studio solution.
    Microsoft, can you confirm whether this is a known issue and whether others have encountered this issue? Is it resolved in a hotfix?
    Anybody else, can you confirm whether you have come up with a solution to this issue? When I mean a solution I mean one that does not mean that I have to rename my namespaces,
    project etc... and is actually workable in a meaningful Visual Studio solution.

    Hi
    Yes, I thought I had fixed this my moving my solution from the usual documents  to
    c:\v2010\projectsOverflow\DetailedProjectTimeline
    This builds ok, but when I come to package I get the lovely error:
    Error 2 The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. C:\VS2010\ProjectsOverflow\DetailedProjectTimeline\VisualDetailedProjectTimelineWebPart\Features\Feature1\Feature1.feature VisualDetailedProjectTimeline
    Now, the error seems to be related to 
    Can anyone suggest what might be causing this. Probably some path in an XML file somewhere. Here is my prime suspect!
    <metaData>
    <type name="VisualDetailedProjectTimelineWebPart.VisualProjectTimelineWebPart.VisualProjectTimeline, $SharePoint.Project.AssemblyFullName$" />
    <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
    </metaData>
    <data>
    <properties>
    <property name="Title" type="string">VisualProjectTimelineWebPart</property>
    <property name="Description" type="string">My Visual WebPart</property>
    </properties>
    </data>
    </webPart>
    </webParts>
    .... Unless I can solve this I will have to remove the project and recreate but with simple paths. Tho I will be none the wiser if I come across this again.
    Daniel

  • TFS Build Error - Exception Message: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters

    I am trying to set-up CI of Orchard CMS and deploy it on Azure using TF service. I am stuck at following error for path being
    longer than 260 characters. However, when counted the total characters in path are 235. Please see the below error :
    Other Errors and Warnings
    1 error(s), 1 warning(s)
    Exception Message: TF400889: The following path contains more than the allowed 259 characters: drop/_PublishedWebsites/Orchard.Web_Package/Archive/Content/C_C/a/src/projects/Orchard/dev/DevAltaf/Orchard/src/Orchard.Web/obj/Debug/Package/PackageTmp/Modules/BrentApart.BannerManager/Scripts/controllers/bannerAssignmentController.js. Specify a shorter path. (type VssServiceException)
    Exception Stack Trace: at Microsoft.TeamFoundation.Build.Workflow.Activities.FileContainerDropProvider.EndCopyDirectory(IAsyncResult result)
    at Microsoft.TeamFoundation.Build.Workflow.Activities.CopyDirectory.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
    at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
    Inner Exception Details:
    Exception Message: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. (type PathTooLongException)
    Did anyone came across such issue while deploying Orchard on Azure with TF service? If yes, how did you sort this freaking error?
    Thanks,
    Altaf B.

    Hi AltafB,
    For your situation, you can short the path for the source code. Or use a short path for build agent folder in your build definition. You can refer to the links below to solve your problem:
    http://blogs.msdn.com/b/aaronhallberg/archive/2007/06/20/team-build-and-260-character-paths.aspx
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/1638a5f0-9321-4ff9-9ee7-6d347badb972/please-some-solution-to-the-specified-path-file-name-or-both-are-too-long?forum=tfsbuild
    Besides, since you deploy Orchard to Azure, you can also publish it directly using publish profile in Visual Stduio or WebMatrix directly.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • In PDF display of smartform in polish langauge - copyright character prob

    hi gurus! In PDF display of smartform in polish langauge - copyright character is not displaying properly.its showing # for copyright character. but It displays in english language. please need ur help. thanks SG

  • Q43: How to get Doc Num, Qty, Doc Num Qty going across the page not down

    Dear All, I would like to know if it is possible to report each and every separate purchase order doc num and qty per Item Code across the page in columns as opposed to a 'downward' list such as this report would produce? SELECT T0.[ItemCode], T0.[Ds

  • Need help on object array, please.

    Hello. I'm trying to write a program that stores student id numbers and their names into an array, and then prints them in numerical order. What I did was create an object called DSCC and put it in an array, but I'm having problems. Everytime I run t

  • Programing Data Acquisition Card AT-DIO-32HS in LabView or ANSI C

    Hello,my name is Andreas an I work the first time with LabView. We bought the NI AT-DIO-32HS card. My problem: I have a rnadom-generator application, with two data-outputs , data1 is the random data, data2 is the shifting frequency from the shift reg

  • 7.1 system speaker support under Windows 7?

    Is it true that under windows vista and 7 creative only support 2.1 speaker systems with there drivers support. I have read it on your software autoupdate, forum etc and on other places on the internet. I thinking of buying your two 7.1 systems.speak