using clob

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sinner
    New Member
    • Mar 2008
    • 15

    using clob

    hi.
    i want the code or reference for insert command using the CLOB datatype.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Please find a related article here .

    Comment

    • sinner
      New Member
      • Mar 2008
      • 15

      #3
      Originally posted by debasisdas
      Please find a related article here .
      thanks for the reference

      Comment

      • subashsavji
        New Member
        • Jan 2008
        • 93

        #4
        Originally posted by sinner
        hi.
        i want the code or reference for insert command using the CLOB datatype.
        [code=oracle]

        create table demo
        ( id int primary key,
        theClob clob
        )
        /

        create or replace directory my_files as 'C:\';
        /

        CREATE OR REPLACE procedure load_a_file( p_id in number,
        p_filename in varchar2 )
        as
        l_clob clob;
        l_bfile bfile;
        begin
        insert into demo values ( p_id, empty_clob() )
        returning theClob into l_clob;
        l_bfile := bfilename( 'MY_FILES', p_filename );
        dbms_lob.fileop en( l_bfile );
        dbms_lob.loadfr omfile( l_clob, l_bfile,
        dbms_lob.getlen gth( l_bfile ) );
        dbms_lob.filecl ose( l_bfile );
        end;
        /

        EXECUTE load_a_file(2,' YY.TXT');

        [/code]
        Last edited by amitpatel66; Mar 4 '08, 07:12 AM. Reason: code tags

        Comment

        • sinner
          New Member
          • Mar 2008
          • 15

          #5
          Originally posted by subashsavji
          [code=oracle]

          create table demo
          ( id int primary key,
          theClob clob
          )
          /

          create or replace directory my_files as 'C:\';
          /

          CREATE OR REPLACE procedure load_a_file( p_id in number,
          p_filename in varchar2 )
          as
          l_clob clob;
          l_bfile bfile;
          begin
          insert into demo values ( p_id, empty_clob() )
          returning theClob into l_clob;
          l_bfile := bfilename( 'MY_FILES', p_filename );
          dbms_lob.fileop en( l_bfile );
          dbms_lob.loadfr omfile( l_clob, l_bfile,
          dbms_lob.getlen gth( l_bfile ) );
          dbms_lob.filecl ose( l_bfile );
          end;
          /

          EXECUTE load_a_file(2,' YY.TXT');

          [/code]
          thanks for the code
          regards

          Comment

          Working...