Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 Oracle PL/SQL: INSERT: Using A Record Jump to:  
Category: >> Oracle PL/SQL >> INSERT: Using A Record Bookmark and Share

<< lastnext >>

Snippet Name: INSERT: Using A Record

Description: Insert by Using RECORD Type Variable.

Also see:
» INSERT With Returning Clause
» Create Table INSERT (CTAS)
» Inserting into SELECT statement
» INSERT WITH CHECK OPTION
» INSERT FIRST WHEN
» INSERT ALL WHEN
» INSERT ALL
» INSERT WHEN
» INSERT with Select
» INSERT: Multiple Column Table Or View ...
» INSERT: Multiple Column Table Or View ...
» INSERT: Single Column Table Or View
» FORALL Insert
» INSERT

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 04th, 2009

-- create demo table
CREATE TABLE Employee(
ID                 VARCHAR2(4 BYTE),
First_Name         VARCHAR2(10 BYTE),
City               VARCHAR2(10 BYTE)
)
/
 
TABLE created.
 
 
 
CREATE OR REPLACE PROCEDURE p_create(i_deptNo VARCHAR, i_dName VARCHAR2, i_loc VARCHAR2) IS
v_row employee%ROWTYPE;
BEGIN
IF LENGTH(i_dName)>10 THEN
        raise_application_error(-20999,'first name is too long');
END IF;
 
v_row.id:=i_deptNo;
v_row.first_Name:=i_dName;
v_row.city:=i_loc;
 
INSERT INTO employee VALUES v_row;
END;
/
 
PROCEDURE created.
 
 
call p_create ('01','new','new');
Call completed.
 
 
SELECT * FROM employee;
 
ID   FIRST_NAME CITY
---- ---------- ----------
01   NEW        NEW
 
 
 
 -- clean the table
 DROP TABLE Employee
/
 
TABLE dropped.


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 245 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?