How to populate data to a TEXT field
Posted in 2008
A 4GL/dbaccess user hit error "-617: A blob data type must be supplied within this context" when trying to insert varchar string data into a TEXT column. Art Kagel explained TEXT is a BLOB, so you can't insert a plain string: in dbaccess it must come from a file, and in I4GL you'd typically call a small ESQL/C routine (see CSDK samples, dbcopy.ec/ul.ec, or the IIUG repository). Jim Tranny gave a pure-4GL workaround: write the data to a text file, use LOCATE to load it into a TEXT variable, then INSERT/UPDATE with that variable. Others suggested sqlldr, and noted Genero 4GL allows direct CHAR/VARCHAR/STRING-to-TEXT assignment.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Data Types & Schema Design
Hi all, This may be a silly question but because it is the first time I have to populate data to a table in which there is a TEXT field. The input data is from a varchar field and I got the error "617: A blob data type must be supplied within this context". Please advise which blob data I have to create to poplulate it to this Text field?. Regards, Long Nguyen MIS(Analyst Programmer) Ruralco Limited P.O.Box 515 Wentworthville NSW 2145 (Ph) 02 9688 8528 (Fax) 02 9896 7763 Disclaimer: This correspondence is for the named person's use only. It may contain confidential or legally privileged information or both. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this correspondence in error, please immediately delete it together with any attachments from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any opinions expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the opinions of Ruralco Holdings Limited or any of its subsidiaries (collectively "Ruralco"). Although all care has been taken to screen this communication for viruses, neither the sender nor Ruralco warrants that any communication via the Internet is free of errors, viruses, interception or interference. Information is distributed without warranties of any kind.
TEXT columns are BLOBs, you cannot insert strings into a BLOB. What host language are you using to insert/update the database? On Mon, Jun 2, 2008 at 8:57 PM, Long Nguyen <lnguyen@ruralco.com.au> wrote: > Hi all, > This may be a silly question but because it is the first time I have to > populate data to a table in which there is a TEXT field. > The input data is from a varchar field and I got the error "617: A blob > data type must be supplied within this context". > Please advise which blob data I have to create to poplulate it to this Text > field?. > Regards, > Long Nguyen > MIS(Analyst Programmer) > Ruralco Limited > P.O.Box 515 > Wentworthville NSW 2145 > (Ph) 02 9688 8528 (Fax) 02 9896 7763 > > Disclaimer: > This correspondence is for the named person's use only. It may contain > confidential or legally privileged information or both. No confidentiality > or privilege is waived or lost by any mistransmission. If you receive this > correspondence in error, please immediately delete it together with any > attachments from your system and notify the sender. You must not disclose, > copy or rely on any part of this correspondence if you are not the intended > recipient. > Any opinions expressed in this message are those of the individual sender, > except where the sender expressly, and with authority, states them to be > the opinions of Ruralco Holdings Limited or any of its subsidiaries > (collectively "Ruralco"). > Although all care has been taken to screen this communication for viruses, > neither the sender nor Ruralco warrants that any communication via the > Internet is free of errors, viruses, interception or interference. > Information is distributed without warranties of any kind. > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > -- Art S. Kagel Oninit (www.oninit.com) IIUG Board of Directors (art@iiug.org) Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Oninit, the IIUG, nor any other organization with which I am associated either explicitly or implicitly. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves.
Hi Art, I use Informix 4GL/dbaccess. Regards, Long N ===================================================== "Art Kagel" <art.kagel@gmail. To: ids@iiug.org com> cc: Sent by: Subject: Re: How to populate data to a TEXT field [12284] ids-bounces@iiug. org 03/06/2008 11:16 AM Please respond to ids TEXT columns are BLOBs, you cannot insert strings into a BLOB. What host language are you using to insert/update the database? On Mon, Jun 2, 2008 at 8:57 PM, Long Nguyen <lnguyen@ruralco.com.au> wrote: > Hi all, > This may be a silly question but because it is the first time I have to > populate data to a table in which there is a TEXT field. > The input data is from a varchar field and I got the error "617: A blob > data type must be supplied within this context". > Please advise which blob data I have to create to poplulate it to this Text > field?. > Regards, > Long Nguyen > MIS(Analyst Programmer) > Ruralco Limited > P.O.Box 515 > Wentworthville NSW 2145 > (Ph) 02 9688 8528 (Fax) 02 9896 7763 > > Disclaimer: > This correspondence is for the named person's use only. It may contain > confidential or legally privileged information or both. No confidentiality > or privilege is waived or lost by any mistransmission. If you receive this > correspondence in error, please immediately delete it together with any > attachments from your system and notify the sender. You must not disclose, > copy or rely on any part of this correspondence if you are not the intended > recipient. > Any opinions expressed in this message are those of the individual sender, > except where the sender expressly, and with authority, states them to be > the opinions of Ruralco Holdings Limited or any of its subsidiaries > (collectively "Ruralco"). > Although all care has been taken to screen this communication for viruses, > neither the sender nor Ruralco warrants that any communication via the > Internet is free of errors, viruses, interception or interference. > Information is distributed without warranties of any kind. > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > -- Art S. Kagel Oninit (www.oninit.com) IIUG Board of Directors (art@iiug.org) Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Oninit, the IIUG, nor any other organization with which I am associated either explicitly or implicitly. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum. Disclaimer: This correspondence is for the named person's use only. It may contain confidential or legally privileged information or both. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this correspondence in error, please immediately delete it together with any attachments from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any opinions expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the opinions of Ruralco Holdings Limited or any of its subsidiaries (collectively "Ruralco"). Although all care has been taken to screen this communication for viruses, neither the sender nor Ruralco warrants that any communication via the Internet is free of errors, viruses, interception or interference. Information is distributed without warranties of any kind.
OK, you cannot insert to a BLOB in dbaccess except from a file. In 4GL,
you'll probably have to write a small 'C' module to call to insert/update
the BLOB column. Don't remember, but there might be such a 4GL callable
function in the IIUG Software Repository. Take a look. Otherwise you'll
have to write it. Take a look at the ESQL/C BLOB examples in the samples
directory if you have the CSDK installed (if not install it) and you can
also look at the BLOB code in my dbcopy.ec and ul.ec utilities for examples.
On Tue, Jun 3, 2008 at 10:43 PM, Long Nguyen <lnguyen@ruralco.com.au> wrote:
> Hi Art,
> I use Informix 4GL/dbaccess.
> Regards,
> Long N
> =====================================================
>
> "Art Kagel"
>
> <art.kagel@gmail. To: ids@iiug.org
>
> com> cc:
>
> Sent by: Subject: Re: How to populate data to a TEXT field [12284]
>
> ids-bounces@iiug.
>
> org
>
> 03/06/2008 11:16
>
> AM
>
> Please respond to
>
> ids
>
> TEXT columns are BLOBs, you cannot insert strings into a BLOB. What host
> language are you using to insert/update the database?
>
> On Mon, Jun 2, 2008 at 8:57 PM, Long Nguyen <lnguyen@ruralco.com.au>
> wrote:
>
> > Hi all,
> > This may be a silly question but because it is the first time I have to
> > populate data to a table in which there is a TEXT field.
> > The input data is from a varchar field and I got the error "617: A blob
> > data type must be supplied within this context".
> > Please advise which blob data I have to create to poplulate it to this
> Text
> > field?.
> > Regards,
> > Long Nguyen
> > MIS(Analyst Programmer)
> > Ruralco Limited
> > P.O.Box 515
> > Wentworthville NSW 2145
> > (Ph) 02 9688 8528 (Fax) 02 9896 7763
> >
> > Disclaimer:
> >
> >
>
>
>
*******************************************************************************
>
> > Forum Note: Use "Reply" to post a response in the discussion forum.
> >
> >
>
> --
> Art S. Kagel
> Oninit (www.oninit.com)
> IIUG Board of Directors (art@iiug.org)
>
> Disclaimer: Please keep in mind that my own opinions are my own opinions
> and
> do not reflect on my employer, Oninit, the IIUG, nor any other organization
>
> with which I am associated either explicitly or implicitly. Neither do
> those opinions reflect those of other individuals affiliated with any
> entity
> with which I am affiliated nor those of the entities themselves.
>
>
>
>
*******************************************************************************
>
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
> Disclaimer:
> This correspondence is for the named person's use only. It may contain
> confidential or legally privileged information or both. No confidentiality
> or privilege is waived or lost by any mistransmission. If you receive this
> correspondence in error, please immediately delete it together with any
> attachments from your system and notify the sender. You must not disclose,
> copy or rely on any part of this correspondence if you are not the intended
> recipient.
> Any opinions expressed in this message are those of the individual sender,
> except where the sender expressly, and with authority, states them to be
> the opinions of Ruralco Holdings Limited or any of its subsidiaries
> (collectively "Ruralco").
> Although all care has been taken to screen this communication for viruses,
> neither the sender nor Ruralco warrants that any communication via the
> Internet is free of errors, viruses, interception or interference.
> Information is distributed without warranties of any kind.
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--
Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art@iiug.org)
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Oninit, the IIUG, nor any other organization
with which I am associated either explicitly or implicitly. Neither do those
opinions reflect those of other individuals affiliated with any entity with
which I am affiliated nor those of the entities themselves.
I 've used sqlldr to insert (append) information with blob fields in
database tables.
Maybe you can try that also.
Regards,
Nadine
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
Art Kagel
Sent: woensdag 4 juni 2008 12:44
To: ids@iiug.org
Subject: Re: How to populate data to a TEXT field [12304]
OK, you cannot insert to a BLOB in dbaccess except from a file. In 4GL,
you'll probably have to write a small 'C' module to call to
insert/update the BLOB column. Don't remember, but there might be such a
4GL callable function in the IIUG Software Repository. Take a look.
Otherwise you'll have to write it. Take a look at the ESQL/C BLOB
examples in the samples directory if you have the CSDK installed (if not
install it) and you can also look at the BLOB code in my dbcopy.ec and
ul.ec utilities for examples.
On Tue, Jun 3, 2008 at 10:43 PM, Long Nguyen <lnguyen@ruralco.com.au>
wrote:
> Hi Art,
> I use Informix 4GL/dbaccess.
> Regards,
> Long N
> =====================================================
>
> "Art Kagel"
>
> <art.kagel@gmail. To: ids@iiug.org
>
> com> cc:
>
> Sent by: Subject: Re: How to populate data to a TEXT field [12284]
>
> ids-bounces@iiug.
>
> org
>
> 03/06/2008 11:16
>
> AM
>
> Please respond to
>
> ids
>
> TEXT columns are BLOBs, you cannot insert strings into a BLOB. What
> host language are you using to insert/update the database?
>
> On Mon, Jun 2, 2008 at 8:57 PM, Long Nguyen <lnguyen@ruralco.com.au>
> wrote:
>
> > Hi all,
> > This may be a silly question but because it is the first time I have
> > to populate data to a table in which there is a TEXT field.
> > The input data is from a varchar field and I got the error "617: A
> > blob data type must be supplied within this context".
> > Please advise which blob data I have to create to poplulate it to
> > this
> Text
> > field?.
> > Regards,
> > Long Nguyen
> > MIS(Analyst Programmer)
> > Ruralco Limited
> > P.O.Box 515
> > Wentworthville NSW 2145
> > (Ph) 02 9688 8528 (Fax) 02 9896 7763
> >
> > Disclaimer:
> >
> >
>
>
>
************************************************************************
*******
>
> > Forum Note: Use "Reply" to post a response in the discussion forum.
> >
> >
>
> --
> Art S. Kagel
> Oninit (www.oninit.com)
> IIUG Board of Directors (art@iiug.org)
>
> Disclaimer: Please keep in mind that my own opinions are my own
> opinions and do not reflect on my employer, Oninit, the IIUG, nor any
> other organization
>
> with which I am associated either explicitly or implicitly. Neither do
> those opinions reflect those of other individuals affiliated with any
> entity with which I am affiliated nor those of the entities
> themselves.
>
>
>
>
************************************************************************
*******
>
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
> Disclaimer:
> This correspondence is for the named person's use only. It may contain
> confidential or legally privileged information or both. No
> confidentiality or privilege is waived or lost by any mistransmission.
> If you receive this correspondence in error, please immediately delete
> it together with any attachments from your system and notify the
> sender. You must not disclose, copy or rely on any part of this
> correspondence if you are not the intended recipient.
> Any opinions expressed in this message are those of the individual
> sender, except where the sender expressly, and with authority, states
> them to be the opinions of Ruralco Holdings Limited or any of its
> subsidiaries (collectively "Ruralco").
> Although all care has been taken to screen this communication for
> viruses, neither the sender nor Ruralco warrants that any
> communication via the Internet is free of errors, viruses,
interception or interference.
> Information is distributed without warranties of any kind.
>
>
>
>
************************************************************************
*******
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--
Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art@iiug.org)
Disclaimer: Please keep in mind that my own opinions are my own opinions
and
do not reflect on my employer, Oninit, the IIUG, nor any other
organization
with which I am associated either explicitly or implicitly. Neither do
those
opinions reflect those of other individuals affiliated with any entity
with
which I am affiliated nor those of the entities themselves.
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
Here's one method that works quite nicely using 4GL (although there are a few hoops to hop through). 1) First you'll need to somehow put your varchar data into a text file. One approach would be to use the report functionality in 4GL or use a C function (see iiug repository) to write to a file. 2) Then you can use the 'locate' command to put the data from the text file into a TEXT variable,. 3) Then you can use that var with an insert or update statement. It's been a while since I've had to do this so I may have missed a step. Jim On Tue, Jun 3, 2008 at 10:43 PM, Long Nguyen <lnguyen@ruralco.com.au> wrote: > Hi Art, > I use Informix 4GL/dbaccess. > Regards, > Long N > ===================================================== > > "Art Kagel" > > <art.kagel@gmail. To: ids@iiug.org > > com> cc: > > Sent by: Subject: Re: How to populate data to a TEXT field [12284] > > ids-bounces@iiug. > > org > > 03/06/2008 11:16 > > AM > > Please respond to > > ids > > TEXT columns are BLOBs, you cannot insert strings into a BLOB. What host > language are you using to insert/update the database? > > On Mon, Jun 2, 2008 at 8:57 PM, Long Nguyen <lnguyen@ruralco.com.au> wrote: > >> Hi all, >> This may be a silly question but because it is the first time I have to >> populate data to a table in which there is a TEXT field. >> The input data is from a varchar field and I got the error "617: A blob >> data type must be supplied within this context". >> Please advise which blob data I have to create to poplulate it to this > Text >> field?. >> Regards, >> Long Nguyen >> MIS(Analyst Programmer) >> Ruralco Limited >> P.O.Box 515 >> Wentworthville NSW 2145 >> (Ph) 02 9688 8528 (Fax) 02 9896 7763 >> >> Disclaimer: >> This correspondence is for the named person's use only. It may contain >> confidential or legally privileged information or both. No > confidentiality >> or privilege is waived or lost by any mistransmission. If you receive > this >> correspondence in error, please immediately delete it together with any >> attachments from your system and notify the sender. You must not > disclose, >> copy or rely on any part of this correspondence if you are not the > intended >> recipient. >> Any opinions expressed in this message are those of the individual > sender, >> except where the sender expressly, and with authority, states them to be >> the opinions of Ruralco Holdings Limited or any of its subsidiaries >> (collectively "Ruralco"). >> Although all care has been taken to screen this communication for > viruses, >> neither the sender nor Ruralco warrants that any communication via the >> Internet is free of errors, viruses, interception or interference. >> Information is distributed without warranties of any kind. >> >> >> >> > > ******************************************************************************* > >> Forum Note: Use "Reply" to post a response in the discussion forum. >> >> > > -- > Art S. Kagel > Oninit (www.oninit.com) > IIUG Board of Directors (art@iiug.org) > > Disclaimer: Please keep in mind that my own opinions are my own opinions > and > do not reflect on my employer, Oninit, the IIUG, nor any other organization > > with which I am associated either explicitly or implicitly. Neither do > those opinions reflect those of other individuals affiliated with any > entity > with which I am affiliated nor those of the entities themselves. > > > ******************************************************************************* > > Forum Note: Use "Reply" to post a response in the discussion forum. > > Disclaimer: > This correspondence is for the named person's use only. It may contain > confidential or legally privileged information or both. No confidentiality > or privilege is waived or lost by any mistransmission. If you receive this > correspondence in error, please immediately delete it together with any > attachments from your system and notify the sender. You must not disclose, > copy or rely on any part of this correspondence if you are not the intended > recipient. > Any opinions expressed in this message are those of the individual sender, > except where the sender expressly, and with authority, states them to be > the opinions of Ruralco Holdings Limited or any of its subsidiaries > (collectively "Ruralco"). > Although all care has been taken to screen this communication for viruses, > neither the sender nor Ruralco warrants that any communication via the > Internet is free of errors, viruses, interception or interference. > Information is distributed without warranties of any kind. > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > >
In Genero 4GL this process has been simplified. You can now assign a CHAR, VARCHAR, or STRING variable to a TEXT variable and then do your INSERT http://www.4js.com/online_documentation/fjs-fgl-2.11.01-manual-html/User/NewFeat ures.html#Assigning_value_to_TEXT_2.10