Hi Alexandre,
I have done similar things in the past and have found that casting is
needed. I'm not sure if there is a better way but this should work.
INSERT INTO BLOBTAB (ID, NAME, TEXT)
VALUES
(
1,
'One',
blob(x'41424241') <== Use x'' and cast to blob
)
If what you are inserting actually corresponds to text (the above actually
corresponding to 'ABBA'), you could do something like this as well:
INSERT INTO BLOBTAB (ID, NAME, TEXT)
VALUES
(
1,
'One',
blob('ABBA') <== Cast the string to a blob
)
By the way, I don't know about inserting from a file... hopefully somebody
else can help you with that.
Kelly
Kelly Schlamb
Database Technology, IBM Toronto Lab, Canada
Email: [EMAIL PROTECTED]
Phone: 905-413-2469
DB2 Online Support Website:
http://www.ibm.com/software/data/db2/udb/winos2unix/support
Alexandre Efremov
<ranbow_rabbit@ya To: Joachim Mueller
<[EMAIL PROTECTED]>
hoo.com> cc: [EMAIL PROTECTED]
Sent by: Subject: Re: Antwort: Re: Antwort:
[DB2EUG] Insert BLOB value
owner-db2eug@Lugw
ash.org
02/05/2003 11:28
AM
Please respond to
Alexandre Efremov
Hi, Joachim!
> perhaps you find something within the
> /sqllib/samples directory.
> There are a lot of samples, working with blob's.
Unfortunately, all those samples are related to
embedded SQL code, and not SQL code executed via
command line interface and/or command center. I know
how to work with BLOBs in a C program etc., but hte
question is - how to do this using SQL in db2clp?
Is there a way to do this at all?
Alexandre.
>
> Best regards
>
> Joachim M�ller
> --
> DOUGLAS Informatik & Service GmbH
> Datenbankmanagement
> Douglas Holding AG, Kabeler Str. 4, 58099 Hagen
> Tel.:+49-2331-690-249,Fax:+49-2331-690-78-249
> Mobile: +49-170-2221-249
>
>
>
>
>
--------------------------------+----------------------------------------------------------------------------
>
> Alexandre Efremov|
>
>
> <[EMAIL PROTECTED]| An:
> Joachim Mueller
> <[EMAIL PROTECTED]>
> om>| Kopie:
> [EMAIL PROTECTED]
>
> | Thema:
> Re: Antwort: [DB2EUG] Insert BLOB value
>
> 05.02.2003 17:16|
>
>
> |
>
>
>
>
--------------------------------+----------------------------------------------------------------------------
>
>
>
>
>
> Thanks, Joachim, but I am specifically interested in
> running SQL code, not using DB2 commands.
>
> --- Joachim Mueller
> <[EMAIL PROTECTED]>
> wrote:
> >
> > Hi Alexandre,
> >
> > use db2's load commad...
> >
> > Best regards
> >
> > Joachim M�ller
> > --
> > DOUGLAS Informatik & Service GmbH
> > Datenbankmanagement
> > Douglas Holding AG, Kabeler Str. 4, 58099 Hagen
> > Tel.:+49-2331-690-249,Fax:+49-2331-690-78-249
> > Mobile: +49-170-2221-249
> >
> >
> >
> >
> >
>
--------------------------------+----------------------------------------------------------------------------
>
> >
> > Alexandre Efremov|
> >
> >
> > <[EMAIL PROTECTED]| An:
> > [EMAIL PROTECTED]
> >
> > om>| Kopie:
> >
> >
> > Gesendet von:| Thema:
> > [DB2EUG] Insert BLOB value
> >
> > [EMAIL PROTECTED]|
> >
> >
> > rg|
> >
> >
> > |
> >
> >
> > |
> >
> >
> > 05.02.2003 16:16|
> >
> >
> > Bitte antworten an|
> >
> >
> > Alexandre Efremov|
> >
> >
> > |
> >
> >
> >
> >
>
--------------------------------+----------------------------------------------------------------------------
>
> >
> >
> >
> >
> >
> > Hi, everyone!
> >
> > Is there a way to insert BLOB value to the table
> via
> > command line interface and/or command center? My
> > numerous attempts to do so failed. Then I used SQL
> > assist to generate INSERT statement. SQL assist
> > created the code like this:
> >
> > INSERT INTO
> > BLOBTAB
> > (
> > ID,
> > NAME,
> > TEXT
> > )
> > VALUES
> > (
> > 1,
> > 'One',
> > 41424241
> > )
> >
> > But on attempt to run it, it failed with the
> > following
> > error message:
> >
> > SQL0408N A value is not compatible with the data
> > type
> > of its assignment target. Target name is "TEXT".
> > SQLSTATE=42821
> >
> > So, how do I insert BLOB data using command line
> > interface? Another question - is there a way to
> > specify the name of disk file as a source for LOB
> > data?
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > http://mailplus.yahoo.com
> > -
> > ::: When replying to the list, please use
> > 'Reply-All' and make sure
> > ::: a copy goes to the list ([EMAIL PROTECTED]).
> > *** To unsubscribe, send 'unsubscribe' to
> > [EMAIL PROTECTED]
> > *** For more information, check
> > http://www.db2eug.uni.cc
> >
> >
> >
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
>
>
>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
-
::: When replying to the list, please use 'Reply-All' and make sure
::: a copy goes to the list ([EMAIL PROTECTED]).
*** To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
*** For more information, check http://www.db2eug.uni.cc
-
::: When replying to the list, please use 'Reply-All' and make sure
::: a copy goes to the list ([EMAIL PROTECTED]).
*** To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
*** For more information, check http://www.db2eug.uni.cc