Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: clobs

Re: clobs

From: Gaja Krishna Vaidyanatha <gajav_at_yahoo.com>
Date: Thu, 1 Jun 2000 15:26:15 -0700 (PDT)
Message-Id: <10515.107487@fatcity.com>


OK,

I looks like the server stripped out my attachment. The following is the code dump.

Thanks,

Gaja.



set echo off
set pause off
REM Demonstration of manipulating CLOBS
REM Last modified by Gaja Vaidyanatha 15-NOV-97 REM Made examples more meaningful
REM Modified script to be compliant with 8.0.3 syntax, added REM documentation and made it more elegant

set echo off
PROMPT General Clean Up
set echo on
drop table emp;

set echo off
PAUSE Create EMP_TYP object type
set echo on
CREATE OR REPLACE TYPE emp_typ as object

(   emp_no       NUMBER (7),
    ename       VARCHAR2 (20),
    resume      CLOB );

/

set echo off
PAUSE Create an object table of the emp_TYP type set echo on
CREATE TABLE emp OF emp_typ;

set echo off
PAUSE Insert rows into emp table
set echo on
INSERT INTO emp
VALUES (1, 'Jim Morrison', empty_clob()); INSERT INTO emp
VALUES (2, 'Credence Clearwater', empty_clob()); COMMIT; set serveroutput on
set echo off
PAUSE Create an anonymous PL/SQL block
set echo on
DECLARE

  resume_ptr            CLOB;
  resume_buffer         VARCHAR2 (200);
  resume_offset         NUMBER :=1;
  resume_amount         BINARY_INTEGER := 41;
  lob_length            number := 0;
  lob_contents          VARCHAR2 (200);

BEGIN
  SELECT e.resume INTO resume_ptr
    FROM emp e WHERE e.emp_no = 1
    FOR UPDATE;   lob_length := DBMS_LOB.GETLENGTH(resume_ptr);   dbms_output.put_line('Resume length before: '||to_char(lob_length));
  resume_buffer := '1968 - Formed the music group - The Doors';
  DBMS_LOB.WRITE (lob_loc => resume_ptr,
		  amount  => resume_amount,
		  offset  => resume_offset,
		  buffer  => resume_buffer);

  DBMS_LOB.READ(resume_ptr, resume_amount, resume_offset, lob_contents);
  DBMS_OUTPUT.PUT_LINE (lob_contents);
  lob_length := DBMS_LOB.GETLENGTH(resume_ptr);   dbms_output.put_line('Resume length after: '||to_char(lob_length));
  COMMIT;
END;
/

set echo off
PROMPT *** End of Demo ***


Gaja Krishna Vaidyanatha   | 3460 West Bayshore Road,
Manager - Integration      | Palo Alto, CA 94303
& Consulting Services      | gaja_at_brio.com
Global Alliances           | (650)-565-4442
Brio Technology            | www.brio.com 
Received on Thu Jun 01 2000 - 17:26:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US