CLOB size, Trigger, <PRE>

Posted on 2001-07-11
Medium Priority
Last Modified: 2008-03-17
Q1. CLOB allows 4GB of char data. I created a table like "CREATE TABLE aclob (id number, text clob)". When I do the "desc" on this table it shows me text as CLOB(4000). I tried to enter the data more than 4000 chars and the Oracle gives me the error "ORA-01704: string literal too long". Does that means by default the CLOB allows 4000 max chars. Do I need to create the table something like "CREATE table aclob (id number, text clob(20000)" so that it accept 20000 max chars. I am using Oracle 8.1.5 (with JDBC2.0 API) and Java/JDBC.

Q2. When I do not have any text to enter in my CLOB field I am entering NULL in it. It works fine. But then I came across this method named "empty_clob()". One can use this to insert instead of null. What this method is for. Do we need to use this method *preferably* instead of null in case there are no chars to be inserted in the CLOB field. Any advantages!

Q3. What is the basic difference between Before and After trigger. I think the difference lies only in that in after trigger you cannot set the values of the fields going in the table on which this trigger is fired!

Q4. <PRE>...</PRE> causes a new empty line to be added at its end. How to stop this new emty line to be added.

Question by:javaq092999

Accepted Solution

UsamaMunir earned 150 total points
ID: 6272677
Ans Q2) EMPTY_CLOB() function returns an EMPTY lob locator which can't be used in DBMS_LOB package or in OCI, however setting it to NULL means u can use the locator in DBMS_LOB and OCI. An EMPTY locator is different from the NULL value. if an internaly stored LOB's column value is NULL, then u have to set it to an EMPTY locator value before updating it to a NON NULL value.

Ans Q3) Before Trigger is fired Before a value is inserted update or deleted from a database, while after trigger is fired after the value is being inserted update and deleted into the database. Yes it is true that u can't set the inserted value in tha AFTER insert trigger coz it has already been inserted. AFTER triggers are mostly used to auditing purposes since they don't fire untill the row has been modified, The rows successfull modification implies that it has passed the referential integrity constraints defined for that table. In this scenario BEFORE triggers don't really fit in.

Q-1) NO oracle allows 4 GB of LOB to stored incase of internal and external LOBS. The limit is if the LOB is less then 4k it will be stored in the LOB column other wise if it is greater then 4k it's locator will be stored in the column and value will be stored in the same tablesapce some where else out of line. Oracle automatically shifts from inline to out of line LOBS. Try creating table like this

Create table aLOB
(id number,
text clob)
lob(text) store as LOB_SEG (tablespace LOB_TS
storage(initial 100K next 100K pctincrease 0)
chunk 16K pctversion 10 nocache logging);

Ans Q4) I don't know about that

i hope this helps to an extent


LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6353682
just a friendly reminder...

Author Comment

ID: 6354902
I am using CLOB successfully but with an Upgrade issue with my old database. Initially I used VARCHAR2(2000) to store string data. Later I moved to CLOB instead of VARCHAR2. I moved all the old data into new tables (with CLOB columns) using "INSERT INTO NEW_TABLE AS (SELECT * FROM OLD_TABLE);" All the data comes fine and the data from VARCHAR2 also comes fine into CLOB but on comparision it gives that both are different. Is the above INSERT statement is OK to use for such conversion...

Expert Comment

ID: 6877693
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.  Anytime you have questions which are LOCKED with a Proposed Answer but does not serve your needs, please reject it and add comments as to why.  In addition, when you do grade the question, if the grade is less than an A, please add a comment as to why.  This helps all involved, as well as future persons who may access this item in the future to seek help.

To view your open questions, please click the following link(s) and keep them all current with updates.

To view your locked questions, please click the following link(s) and evaluate the proposed answer.

------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

Moderators will finalize this question if still open in 7 days, by either moving this to the PAQ (Previously Asked Questions) at zero points, deleting it or awarding expert(s) when recommendations are made, or an independent determination can be made.  Expert input is always appreciated to determine the fair outcome.
Thank you everyone.
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.

Expert Comment

ID: 6883217
Thank you for returning and finalizing this question.

Please take an extra moment when you grade questions less than an "A" to comment as to why.  This helps not only the experts who have helped you, but also others in the future who may access this question to get help.  If you've found alternative solutions to achieve your goal and add it here, it further adds value to this item which has not moved to our PAQ (Previously Asked Question database).  Anytime that you need our help, for example, if the grade was chosen in error, let us know by posting a zero point question in the Community Support with the URL to the question involved, we're happy to help.

Moondancer - EE Moderator

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This article will show a step by step guide on how to mask column values in Oracle 12c using DBMS_REDACT full redaction option. This option is available on licensed Oracle Enterprise edition as part of Oracle's Advanced Security.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question