How do I set a maximum length (in characters) of a CLOB field

Hi,
I've seen some questions like this around, but I did not find a clear answer.
This is my problem: I want to make my CLOB field to accept a maximum of 32768 characters. This is because I need other data manipulation tools to receive an ORA error when they try to insert or update text larger than 32768.
I tried with an Insert/Update trigger, but I received ORA error that actually means that LOB fields can not be used in update trigger(or something).
Please, help!

Maybe, Not a neat way to do things, but seems to work.
Others may be able to suggest better solutions.
SQL> create table test_lob(lob clob) ;
Table created.
SQL> CREATE OR REPLACE FUNCTION getlength(p_lob CLOB) RETURN NUMBER DETERMINISTIC IS
  2  BEGIN
  3      IF (dbms_lob.getlength(p_lob) > 32768)
  4      THEN
  5          raise_application_error(-20100,
  6                                  'Text may not be greater than 32768 characters!');
  7      ELSE
  8          RETURN NULL;
  9      END IF;
10  END;
11  /
Function created.
SQL> create index idx_test_lob on test_lob(getlength(lob)) ;
Index created.
SQL>
SQL> declare
  2    l_lob CLOB ;
  3  begin
  4    insert into test_lob values (empty_clob()) returning lob into l_lob ;
  5    dbms_lob.writeappend(l_lob, 32767, rpad('*', 32767, '*')) ;
  6  end ;
  7  /
PL/SQL procedure successfully completed.
SQL> declare
  2    l_lob CLOB ;
  3  begin
  4    insert into test_lob values (empty_clob()) returning lob into l_lob ;
  5    dbms_lob.writeappend(l_lob, 32760, rpad('*', 32760, '*')) ;
  6    dbms_lob.writeappend(l_lob, 8, rpad('*', 8, '*')) ;
  7  end ;
  8  /
PL/SQL procedure successfully completed.
SQL> declare
  2    l_lob CLOB ;
  3  begin
  4    insert into test_lob values (empty_clob()) returning lob into l_lob ;
  5    dbms_lob.writeappend(l_lob, 32760, rpad('*', 32760, '*')) ;
  6    dbms_lob.writeappend(l_lob, 9, rpad('*', 9, '*')) ;
  7  end ;
  8  /
declare
ERROR at line 1:
ORA-20100:
ORA-06512: at "SYS.DBMS_LOB", line 789
ORA-06512: at line 6
SQL> select count(*) from test_lob ;
  COUNT(*)
         2
1 row selected.
SQL>

Similar Messages

  • How to set the maximum length in a JTextField component.

    Hi This is a basic doubt. How can i set the maximum lenght in a JTextField.. I tried the setColumns() method. It doesnt do anything.. Pls Help.
    Thanks
    Rajeev

    Here's an example using PlainDocument.
    textField.setDocuemnt( new TextFieldVerifier() );
    class TextFieldVerifier extends PlainDocument {
    int requiredLength = 10; // whatever length you want
    public void insertString( int offset, String str, AttributeSet attSet ) throws BadLocationException {           
    boolean valid = true;          
    if (str == null) {
    return;
    String old = getText( 0, getLength() );
    /* insert the new string at the given offset, into the old string */     
    String newStr = old.substring( 0, offset ) + str + old.substring( offset );
    if (newStr.length() > requiredLength)
    valid = false;
    Toolkit.getDefaultToolkit().beep();
    if ( valid )
    super.insertString( offset, str, attSet );
    }

  • How to set the maximum length that a user can enter in Msgstyledtextinput

    Hi Everyone,
    I'm currently using EBS 11.5.1 and 10.2g DB
    Is there a way that I can set the maximum length that a user can input?
    I changed the Maximum Length to lower number (from 150 to 100) but I get the following error.
    Developer Mode Exception encountered in item SaveLocation
    Error: The item SaveLocation has a maximum length (100)
             which is not equal to that of the corresponding VO attribute
           , SaveLocation length (150).
    Action: Make sure they are equal in size. There must be other way to set that value
    Thanks,
    Elmer

    You have to set the maximum length of column to 150 to avoid this error.
    You can set the same in Jdev.
    Thanks
    --Anil                                                                                                                                                                                                                                                       

  • How do I identify the maximum length of video in iMovie which can be made into a dvd in iDVD, please?

    How do I identify the maximum length of video in iMovie which can be made into a dvd in iDVD, please?
    I made a sellection of video clips  > pressed on "share" > on iDVD >  after one hour of formating the message was under "project duration"  : "Your project exceeds the maximum content duration. To burn your DVD, change the encoder setting in the Project Info window."
    I have edited out some of the clips and waited anothe hour or so bu the same message appeared !
    I want to know in advance how long can be the video clip sellection for the quality of video chosen ( the best before HD).
    please help if ou can.
    thank you very much indeed.
    Michael
    North London

    It's trying to tell you to change the encoding setting:
    iDVD encoding settings:
    http://docs.info.apple.com/article.html?path=iDVD/7.0/en/11417.html
    Short version:
    Best Performance is for videos of up to 60 minutes
    Best Quality is for videos of up to 120 minutes
    Professional Quality is also for up to 120 minutes but even higher quality (and takes much longer)
    That was for single-layer DVDs. Double these numbers for dual-layer DVDs.
    Professional Quality: The Professional Quality option uses advanced technology to encode your video, resulting in the best quality of video possible on your burned DVD. You can select this option regardless of your project’s duration (up to 2 hours of video for a single-layer disc and 4 hours for a double-layer disc). Because Professional Quality encoding is time-consuming (requiring about twice as much time to encode a project as the High Quality option, for example) choose it only if you are not concerned about the time taken.
    In both cases the maximum length includes titles, transitions and effects etc. Allow about 15 minutes for these.
    You can use the amount of video in your project as a rough determination of which method to choose. If your project has an hour or less of video (for a single-layer disc), choose Best Performance. If it has between 1 and 2 hours of video (for a single-layer disc), choose High Quality. If you want the best possible encoding quality for projects that are up to 2 hours (for a single-layer disc), choose Professional Quality. This option takes about twice as long as the High Quality option, so select it only if time is not an issue for you.
    Use the Capacity meter in the Project Info window (choose Project > Project Info) to determine how many minutes of video your project contains.
    NOTE: With the Best Performance setting, you can turn background encoding off by choosing Advanced > “Encode in Background.” The checkmark is removed to show it’s no longer selected. Turning off background encoding can help performance if your system seems sluggish.
    And whilst checking these settings in iDVD Preferences, make sure that the settings for NTSC/PAL and DV/DV Widescreen are also what you want.
    http://support.apple.com/kb/HT1502?viewlocale=en_US

  • Set the maximum length of textedit element in webdynpro

    Hi All,
      How to set the maximum length of texedit element to a some constant characters.setting col and row property to 10 and 2 didnot set max length to 40.setting width and height also didnt helped to limit the characters user can enter to 20.
    Thanks,
    pkv

    >
    pkv wrote:
    > Hi All,
    >
    >   How to set the maximum length of texedit element to a some constant characters.setting col and row property to 10 and 2 didnot set max length to 40.setting width and height also didnt helped to limit the characters user can enter to 20.
    >
    > Thanks,
    > pkv
    Hi,
    Setting row and height is for layout purposes and not for the limiting of text in a TextEdit UI Element.
    To ensure that the Text Exit has only 40 characters in 04s - you can do as Alka has suggested.
    For doing the same in CE 7.1 - you can use the onChange Action and write code inside that method to limit the number of characters.
    I would suggest that you use IWDMessageManager to show a message in the MessageTray whenever the user goes over the limit of 40 characters - rather than accept the whole text and then show some sort of popup.
    Thanks.
    p256960

  • How can I set the maximum number of restarts for my PDF files?

    I want sent my PDF to a friend,but I just allow him see it only twice.
    How can I set the maximum number of restarts for my PDF files?
    My software edition is Acrobat X

    In the old days when PDFs were only opened on desktops and only in Acrobat or Reader, scripting could fake security features and people were generally convinced. As there are so many ways to open a PDF without scripts ever being run (from mobile devices to in-browser display, or simply opening the file in Illustrator), none of that works anymore.

  • How Do You Set the Maximum Size of a JFrame?

    Can someone show me a quick example? The JFrame can be empty, I just want to know how to set it's maximum size. I tried using setMaximumSize() and it doesn't work for some reason but setMinimumSize() works fine.
    I tried it using a BoxLayout and even using null as a layout manager and can't get it to work. I heard that the other layout managers don't allow you to set the maximum size of a JFrame so that is why I tried it with the layouts that I did.
    I tried the following code (imported the necessary classes), but it does not work...
    public class MyFrame extends JFrame
        public MyFrame()
            super("TestFrame");
            setLayout( new BoxLayout(getContentPane(), BoxLayout.X_AXIS)  );       
            setMaximumSize( new Dimension(400,200));
            setSize(300,150);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setVisible( true );                
    }// end class

    Reposted from
    {color:#0000ff}http://forum.java.sun.com/thread.jspa?threadID=5236259{color}
    @OP:
    When you repost a topic, please always provide a link to the previous post so people can check what suggestions were already offered (and didn't solve the problem).
    Better still, give a short summary of the advice you have already tried.
    I suggested setBackground(...) so you can see whether your MyFrame is actually occupying the entire real estate of the window. Looks as if trying it out (which I would have done for you if I'd been at home, where my JDK is) would have been too much effort for you.
    I'm pretty much a novice in Swing, but I can tell you this: setLayout controls the layout of components added to the JFrame, not the layout of the frame with respect to its parent container.
    Luck, Darryl

  • How do I set a maximum value to a cell in Numbers?

    I have a cell which references a percentage in the previous cell, example: =TRUNC(C2*1000,0)
    So, the cell that it references (C2) is a percentage, anything from 0% up. The issue that I have is that I want to limit the cell's response to the percentage by setting the maximum at 1000. So, if the percentage in the cell is 104%, I don't want the cell to return 1040, I want it to return a maximum of 1000. The MAX function in Numbers is just for searching cells to find the highest numeric value, and there is no IF THEN statements that I can make in the cell, you can do IF, but it just returns a true or false value. I hope I provided enough info for someone to be able to help me out. I have been trying to figure out if there is a mathematical way that I can limit the response to 0-1000 and still have it be accurate to the percentage but I have not come across anything yet.
    Thanks

    Hello
    =IF(C>1,1000,TRUNC(C*1000,0))
    will do the trick.
    Yvan KOENIG (from FRANCE mardi 13 mai 2008 17:47:01)

  • How to get the size/maximum length of an varchar?

    Hello,
    Is there a (Oracle-)function determining the size/max.length on an varchar2-column/-variable in PL/SQL? E.g. like SIZEOF(myVar), SIZE(myVar) in other languages...
    Regards,
    Martin

    Nuerni wrote:
    Karthick,
    Your solution is interesting. I'm thinking of writing my own function (but it handles table's columns only - no PL/SQL-declared variables of varchar-type)...
    It seems there's no Oracle-character-function available returning such numeric values....
    ...could be an enhancement for further releases :-) ?!In my experience everytime you need to think about defined length you have a logical problem in you database design.
    Of Cause you define how large a column value could be ant set those values accordingly.
    But since you define that, your also implement it in the code.
    Everytime the code needs to look at columns sizes or length restrictions, something is wrong.
    Maybe tell us the whole picture and it would be possible to find other ways of improvement.
    Also remember that you can declare variables with a column type in pl/sql.
    v_salary emp.sal%type;
    Edited by: Sven W. on Sep 24, 2008 12:42 PM

  • How do i set still frame length default?

    hello,
    an animator gave me some sequential .png files for a short 5 second clip.
    they are all still frames, but my final cut keeps importing them each as 10 seconds in length as default.
    how do i make it one frame each so that when i drag to my timeline it flows like a video?
    thanks!
    steven

    Final Cut Pro: User Preferences: Editing Tab
    First box is "Still/Freeze Duration." Set that to your desired length, in your case, one frame. When you place your frames on the timeline, they should now be one frame each.
    You may have to create a new sequence for this to take effect (I can't remember right now if this is one of the settings that requires a new sequence or not).

  • How to find out the maximum length of the characters specified within CLOB

    I have given a table which has a column with datatype CLOB . I want to find out the maximum legth of the string within this variable and also want to print that variable.
    Thanks for your help.

    SELECT
         MAX(DBMS_LOB.GETLENGTH(clob_column))
    FROM
         your_table

  • How do you set default transition length?

    Have dissolve as default, where do I go in order to tell what default transition length I want? Thanks.

    Where is the Effects Tab? Sorry, am a rank beginner in FCP. You don't mean to go up to the dropdowns at the top "File...Edit...View..." and so on, and select Effects, because I'm not seeing any place to do that. Where's the Effects tab? Can't seem to bring it up. Thanks.

  • How do you set a song length to match a specific time?

    Example:
    I have a five minute montage video and I'd like to export out a melody to match the five minute video without going through the process of manually building a song.
    This app may be too powerful for what I'm trying to do.
    Tips?

    Did you ever get an answer to your question?

  • How can I set my filter to bring only zeros for the field?

    I have a field that has Number as data type in a table in Access. I only want to extract only zero values.
    Field1     Field2
    Orange    33
    Apple       0
    pumpkin  0
    Tangerine 12
    I appreciate your input.
    GGGGGNNNNNN
    GGGGGNNNNN

    Try a LEFT JOIN --
    SELECT [All Applications-Western].ApplicationNumber, [NN List - Western].approved
    FROM [All Applications-Western] LEFT JOIN [NN List - Western] ON [All Applications-Western].DealerNumber = [NN List - Western].DealerNumber
    WHERE ((([NN List - Western].approved)=0));
         OR a RIGHT JOIN --
    SELECT [All Applications-Western].ApplicationNumber, [NN List - Western].approved
    FROM [All Applications-Western] RIGHT JOIN [NN List - Western] ON [All Applications-Western].DealerNumber = [NN List - Western].DealerNumber
    WHERE ((([NN List - Western].approved)=0));
    Build a little, test a little

  • HOW CAN WE INCREASE THE MAXIMUM SIZE (30 CHARACTERS) OF AN INDEX NAME ?

    I really don't see anything mentioning that on the Oracle Documentation ... can anyone help ?

    Hi
    Sorry, but it is not possible. Size of object names is foxed in data dictionary so you cannot change them.
    Regards
    null

Maybe you are looking for

  • How to save 4 versions of a file in the application server

    Hi,    I have to write a program which will extract few data from SAP and write it in a file in the SAP application server. This program will be run once every month. I need to save 4 versions of the files, current and 3 prior.  These versions should

  • JDBC with win 98 (any problems or smoth like XP)

    Hi guys, A new client of mine has a network of 6 computers where all of them are running under winXP and his computer is running under win98 (go figure?!) Anyway, I have created a Java console application that use MS db and it works beautiful. My con

  • Safari closing without warning-MacBookAir

    Recently I upgraded to lion and also to cloud. The new cloud tabs at the top of the screen show top sites,recent documents and current page. Today, I have had repeted cases of Safari closing without warning.I restarted my MacBookAir but the problem i

  • How to setup default print to landscape in Reportviewer (printmode activex)

    We have an ASP.NET (2008) application and use the ReportViewer Web Control to show a Crystal Report on the client browser.    - We set the "PrintMode" property to ActiveX in order to print to the client's local printer.    - We set up the Landscape i

  • Condition record for UTXJ

    Hi All, This scenario was in TAXINJ. When I am trying to maintain condition record of 100% for UTXJ condition type with tax code A1, system is giving error as " Tax indicator A1 has percentage rate          8.000". Where I have maintained 8% in JIN6