This script demonstrates returning clause : Data Insert « PL SQL « Oracle PL / SQL






This script demonstrates returning clause

    

SQL> CREATE TABLE book (
  2      id   NUMBER (10) PRIMARY KEY,
  3      isbn             CHAR(10 CHAR),
  4      description      CLOB,
  5      descr  NCLOB,
  6      book_cover       BLOB,
  7      chapter_title    VARCHAR2(30 CHAR),
  8      chapter          BFILE
  9   ) ;

Table created.

SQL>
SQL>
SQL>
SQL> SET SERVEROUTPUT ON LONG 64000
SQL>
SQL> DECLARE
  2      v_clob CLOB;
  3   BEGIN
  4      INSERT INTO book (id,isbn,description,descr,book_cover,chapter)VALUES (1,'3', 'A',EMPTY_CLOB(),EMPTY_BLOB(),BFILENAME('book_LOC', '3.jpg'))RETURNING description INTO v_clob;
  5      COMMIT;
  6
  7      DBMS_OUTPUT.PUT_LINE(v_clob);
  8   EXCEPTION
  9      WHEN OTHERS
 10      THEN
 11         DBMS_OUTPUT.PUT_LINE(SQLERRM);
 12   END;
 13   /
A

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL>
SQL>
SQL> drop table book;

Table dropped.

SQL>
SQL>
SQL>

   
    
    
    
  








Related examples in the same category

1.Use in parameter to pass value and insert value to a table
2.Data insert in a procedure
3.Insert data in procedure
4.Insert value passed in by parameter to a table
5.Insert value to a table after calculation
6.Insert value to product and productcategory with stored procedure
7.Insert value to table with for loop
8.Insert a specified number of suppliers and products per supplier
9.Insert 100000 rows into a table with for loop
10.Loop through all to do a bulk insert
11.An anonymous block program to write the record to a row
12.Bulk insert with insert ... select
13.Hard code value and insert