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

Home -> Community -> Usenet -> c.d.o.server -> PL/SQL Insert

PL/SQL Insert

From: John Harris <jharri_at_sapient.com>
Date: Wed, 2 Sep 1998 17:13:34 -0400
Message-ID: <0685A427A719D11197BB00A024D3994507F84BA6@delphi.sapient.com>


Try

Insert into datafile
values (data_record.fld_a,data_record.fld_b);

But be very careful if you do not explicitly name the columns you are inserting the values into
and you later modify the table by adding a column, or recreate the table with a different column order
things could get very messy. When you do not name the columns you are inserting oracle inserts the first data value into the first column in the table and the second value into the second column etc. This works fine until the order of columns changes. If you are lucky you will get a data type error. If you are unlucky the load will succeed and you will have the wrong data in the wrong column!

		-----Original Message-----
		From:	dejaron_at_my-dejanews.com
[mailto:dejaron_at_my-dejanews.com]
		Posted At:	Wednesday, September 02, 1998 1:07 PM
		Posted To:	server
		Conversation:	PL/SQL Insert
		Subject:	PL/SQL Insert

		Is there a simple way to INSERT a row without having to
list each field name?
		Here's a code example...


		DECLARE

		data_record               data_file%ROWTYPE;

		BEGIN;

		data_record.fld_a := 'ABC123';
		data_record.fld_b := 1234.56;

		INSERT INTO data_file
		    {what to put here?}

		END;


		I have a large record with over 100 fields and listing
them (specifically
		maintaining them) is a hassle.

		Your help is appreciated.





		-----== Posted via Deja News, The Leader in Internet
Discussion ==-----
		http://www.dejanews.com/rg_mkgrp.xp   Create Your Own
Free Member Forum Received on Wed Sep 02 1998 - 16:13:34 CDT

Original text of this message

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