Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.oracle    |    Overblown overpriced overengineered SHIT    |    2,288 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 1,006 of 2,288    |
|    Hans Forbrich to Raj Kotaru    |
|    Re: Inserting multiple rows in sqlplus    |
|    23 Jan 04 05:01:59    |
   
   From: hforbric@yahoo.net   
      
   Raj Kotaru wrote:   
   >   
   > Hi,   
   >   
   > In sqlplus, I can insert a single row using:   
   >   
   > insert into employee   
   > (name, salary, hiredate)   
   > values   
   > ('xyz', '86378', sysdate);   
   >   
   > Is there a modification of the insert command that will allow me to   
   > insert more than one row into a table without having to resort to   
   > multiple "insert into ..." statements?   
   >   
   > For example, can I insert two rows via something that lloks like:   
   >   
   > insert into employee   
   > (name, salary, hiredate)   
   > values   
   > {   
   > ('xyz', '86378', sysdate),   
   > ('abc', '84249', sysdate-1)   
   > };   
   >   
   > Here I am assuming that { } encloses all valid rows, with () enclosing   
   > a single row within the surrounding {}.   
   >   
   > I do not want to use the sql loader, PL-SQL, or SQL-PLUS constructs   
   > like functions, scripts, and stored procedures.   
   >   
   > Thanks   
   > Raj   
      
   Oracle does not support what you ask, and AFAIk neither does the SQL   
   standard. (Corrections appreciated if I'm wrong here.)   
      
   I'm not sure why *you* want this, although I can think of several   
   reasons. Nor do I know your environmnt, your Oracle version, your   
   operating system version, or your data source. I'd certianly be   
   interested in the reasoning behind your restrictions about SQL Loader,   
   etc.   
      
   Some alternate ways I've used to do something like this:   
      
   1) With a flat file and Oracle9i, consider External Tables;   
   2) If data is in the database already, use CTAS;   
   3) Create a SQL Plus script to contains all inserts. If possible   
   (incredibly easy in unix/linux), generate the script using sed, awk or   
   perl. Cut size by inserting against a view that maps only to the   
   columns you want, eliminating the column spec.   
      
   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca