Feb 17, 2011 12:23 PM
How to use Clobs in Netezza
-
Like (0)
Hi,
Is there clob in netezza? If so, where can I find documentations on this? I am trying to write a dynamic SQL to insert data into a table with 100 columns. I think I will need to use clob in order to make this work. I assume dynamic sql will not slow down the performance tremendouly.
In addition, is there anyway that I can check if there is any ddl change for any tables in netzza?
thanks for the help in advance!
Netezza does not have CLOBs but a VARCHAR can hold up to 64KB. What are you doing that makes you believe you need a CLOB?
I need to append data to different tables. Instead of writing store procedure for each table with something like
"insert into tablename (columns...) select columns from sourcetablename"
I think I can take the table name as a parameter, and generate the insert statement above dynamically. Then, use "EXECUTE IMMEIDATE" to actually run the SQL. This way, I only need one store procedure. Since most of the tables are huge, I think I may need a CLOB to do this. The other way is to generate the SQL with external table and just execute the SQL with shell script. However, I am not sure if there will be anything performace impact.
I can just do the following
"insert into tablename (columns...) select * from sourcetablename"
However, I will need to detect any ddl change in source system. I am not sure if it is possible in netezza.
thanks for the help again!
Assuming that your average column name is <= 20 characters, a 64000 byte varchar could hold 64000/20 = 3200 columns. Even if you repeat them twice that still gives you 1600 columns. I suspect that the 64000 byte varchar will easily hold the SQL that you want to generate for use with EXECUTE IMMEDIATE.
I guess I do not have much choices in this case.
Is there anything that will help me to check if there is any DDL changes for any tables? I checked _v_objects and I can only find creation date. I assume creation date is different from modificaiton date. There are some dbms package in oracle that will allow me to check for this. I did not find anything that will help me with netezza.
Thanks for the help!
Hello,
I want to use CLOB or something like CLOB to put the data which is there is a column into a different table since it is of huge size and my table is exceeding the max allowed size if I include it in the original one.
What can I use if netezza does not suport clob, or do I need to do any pre processing? Also is there any alternate method.
Please Advise, thanks.
Saket Kale.
One way is to keep the required file outside of NPS and only keep pointer/link of file location in the table.
Kapil
What kind of ddl changes are you looking to detect? What is an example of how the ddl is being changed? Quite often in Netezza, ddl is changed with a CTAS. This is basically creating a new object (which later gets renamed to the original object's name). That results in a whole new object ID and create timestamp.
Hello Chris,
I have a column in my table which has become too big to handle so I would like to use something like CLOB or similar to create a reference automatically(is what I understood what CLOB does after reading up on it in reference to DB2 etc).
So I would like to have this column in a different table altogether and just have some reference here in my main table.
Please Advise,
Saket Kale.
You can have either a VARCHAR(64000) or NVARCHAR(16000) column. Their is a total row width limit of 64K bytes. You are on your own as far as assigning keys between the two tables (use a sequence). What DB2 is doing (and Oracle has similar options) is a physical implementation for storing large objects that is not supported in Netezza (as they don't support large objects). So you need to define your own table and manage relationships.
As long as the CLOB data fits and only contains character data, you should be ok. If you are trying to store binary data (pictures, audio, video, etc...), this will not work because character set encoding may corrupt the contents in the column. Such BLOBs should be stored externally and referenced via a URL stored in the Netezza table.
Hello Nick,
Thanks for he response.
I was not able to use the whole size since I have got many other columns which are also relatively big.
So, there is nothign as such which will internally manage large objects, maybe will have to separate these fields in the flat file itself and then load these differently.
I will update this post once I complete this separation and loading.
Lets us hope it happens.
Thanks for the help.
Saket Kale.

