By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,533 Members | 1,497 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,533 IT Pros & Developers. It's quick & easy.

vargraphic column Question.

P: n/a
When I try to create a table with a vargraphic column I get the following
error.

CREATE TABLE EIITEST.IRFAN ("VARC" VARCHAR (48) , "VARGRA" VARGRAPHIC (96) )
DATA CAPTURE NONE IN USERSPACE1;
----------------------------------------------------------------------------
-
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL1216N Graphic data and graphic functions are not supported for this
database. SQLSTATE=56031

This is probably because my database is not setup as unicode or double byte.
But then wouldn't it mean that even my VARCHAR column can store unicode
data. Then whats the purpose of VARGRAHPIC

Irfan.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Irfan Bondre wrote:
When I try to create a table with a vargraphic column I get the following
error.

CREATE TABLE EIITEST.IRFAN ("VARC" VARCHAR (48) , "VARGRA" VARGRAPHIC (96) )
DATA CAPTURE NONE IN USERSPACE1;
----------------------------------------------------------------------------
-
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL1216N Graphic data and graphic functions are not supported for this
database. SQLSTATE=56031

This is probably because my database is not setup as unicode or double byte.
But then wouldn't it mean that even my VARCHAR column can store unicode
data. Then whats the purpose of VARGRAHPIC

Irfan.

(VAR)GRAPHIC in Unicode (as an example) stores data is UCS-2 (16 bit per
charcter + substitution charcters). In (var) char UTF-8 is used.
LENGTH() on a graphic column will always return the character length for
the first plane of Unicode. On the downside GRAPHIC on average uses
more space. (var)char by contrast is byte based. a VARCHAR(10) holds at
most 10 characters, at worst 3 (I think). On average varchar uses less
space. E.g. if all your characters are ASCII you are down to 1 byte per
character.
VAR(GRAPHIC) is a DB2 proprietary type.
Out of interest may I ask what your intention is? Do you need Unicode in
a non-Unicode database? What are your options of migrating to all
Unicode instead? I'm asking because opinions vary on where to invest. So
I'm curious for feedback from the group.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2

P: n/a
Thanks for the response Serge,
Our application deals with Varchar and Vargraphic ( for that matter varchar
and Nvarchar on other databases ) seamlessly.

So somebody could write a query which could get translated to Select
varchar_column_data || vargraphic_column_data from test_table.

In Oracle it seems the functions handle varchar and nvarchar data with out
any issue, in oracle the above query would return Nvarchar data.

The above query also works in DB2.

About Do you need Unicode in a non-Unicode database? Can we have that in
DB2 V7. It certainly possible in Oracle with Nvarchar.
However with DB2 V8.2, when I create a table with vargraphic column I get
the following error? Is there a work around for that?

CREATE TABLE EIITEST.IRFAN ("VARC" VARCHAR (48) , "VARGRA" VARGRAPHIC (96) )
DATA CAPTURE NONE IN USERSPACE1;

DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL1216N Graphic data and graphic functions are not supported for this
database. SQLSTATE=56031

I there some useful reference for Vargraphic data and mixing varchar and
vargraphic data?

Thanks

Irfan.

"Serge Rielau" <sr*****@ca.ibm.com> wrote in message
news:35*************@individual.net...
Irfan Bondre wrote:
When I try to create a table with a vargraphic column I get the following error.

CREATE TABLE EIITEST.IRFAN ("VARC" VARCHAR (48) , "VARGRA" VARGRAPHIC (96) ) DATA CAPTURE NONE IN USERSPACE1;


--------------------------------------------------------------------------

--
-
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:
SQL1216N Graphic data and graphic functions are not supported for this
database. SQLSTATE=56031

This is probably because my database is not setup as unicode or double byte. But then wouldn't it mean that even my VARCHAR column can store unicode
data. Then whats the purpose of VARGRAHPIC

Irfan.

(VAR)GRAPHIC in Unicode (as an example) stores data is UCS-2 (16 bit per
charcter + substitution charcters). In (var) char UTF-8 is used.
LENGTH() on a graphic column will always return the character length for
the first plane of Unicode. On the downside GRAPHIC on average uses
more space. (var)char by contrast is byte based. a VARCHAR(10) holds at
most 10 characters, at worst 3 (I think). On average varchar uses less
space. E.g. if all your characters are ASCII you are down to 1 byte per
character.
VAR(GRAPHIC) is a DB2 proprietary type.
Out of interest may I ask what your intention is? Do you need Unicode in
a non-Unicode database? What are your options of migrating to all
Unicode instead? I'm asking because opinions vary on where to invest. So
I'm curious for feedback from the group.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.