Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    39

    Question Unanswered: how to insert values into varchar2 field

    how to insert values into varchar2 field
    example
    table t1 ( id number , detail varchar2(4000) );

    I have data for value field in saperate files. These are some html scripts less than 4000 characters. I can generate id field but how can I insert the content of each file into a new row in this table t1. I don't want to use clob here.

    Thanks
    the out put should be
    col id column detail
    1 <html>
    <sdsd> 'dffjfd' <sdsd>
    .....
    ....
    </html>
    2 <new>
    ....
    ....
    </new>
    etc....

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    1) USE PL/SQL & UTL_FILE
    OR
    2) PERL

  3. #3
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    273
    Hi ydj,

    You can not insert html data through the way you show into the VARCHAR2 (4000). But it can be inserted as below.

    INSERT INTO t1 VALUES (
    1, '<html> <sdsd> 'dffjfd' <sdsd> .... ...etc');

    If you want your data stored as you explained, you have to use lob.
    Bhavin

    MS Computer Science
    OCP DBA 9i/8i

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Originally posted by Hings
    Hi ydj,

    You can not insert html data through the way you show into the VARCHAR2 (4000). But it can be inserted as below.

    INSERT INTO t1 VALUES (
    1, '<html> <sdsd> 'dffjfd' <sdsd> .... ...etc');

    If you want your data stored as you explained, you have to use lob.
    1) The embedded single quotes make you "solution" not workable;
    as presented.
    2) Why must a LOB be used? I'll bet you, a LOB is not necessary.

  5. #5
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    273
    you r right, that lob is not a must.

    thanks
    Bhavin

    MS Computer Science
    OCP DBA 9i/8i

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •