Solved

CLOB size, Trigger, <PRE>

Posted on 2001-07-11
5
4,793 Views
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.

Regards
0
Comment
Question by:javaq092999
5 Comments
 
LVL 3

Accepted Solution

by:
UsamaMunir earned 50 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

Regards
UsamaMunir







0
 
LVL 142

Expert Comment

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

Author Comment

by:javaq092999
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...
0
 
LVL 1

Expert Comment

by:Moondancer
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.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
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.
http://www.experts-exchange.com/questions/Q.20023290.html
http://www.experts-exchange.com/questions/Q.20121869.html
http://www.experts-exchange.com/questions/Q.20126064.html
http://www.experts-exchange.com/questions/Q.20139990.html
http://www.experts-exchange.com/questions/Q.20143257.html
http://www.experts-exchange.com/questions/Q.20148988.html
http://www.experts-exchange.com/questions/Q.20150711.html
http://www.experts-exchange.com/questions/Q.20158263.html
http://www.experts-exchange.com/questions/Q.20163902.html
http://www.experts-exchange.com/questions/Q.20163903.html
http://www.experts-exchange.com/questions/Q.20181528.html
http://www.experts-exchange.com/questions/Q.20245208.html
http://www.experts-exchange.com/questions/Q.20245590.html
http://www.experts-exchange.com/questions/Q.20251382.html
http://www.experts-exchange.com/questions/Q.20253111.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.20143170.html
http://www.experts-exchange.com/questions/Q.20143993.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  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.
 
Moondancer
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.
0
 
LVL 1

Expert Comment

by:Moondancer
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.

Thanks,
Moondancer - EE Moderator
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Via a live example, show how to take different types of Oracle backups using RMAN.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now