dbTalk Databases Forums  

multi table insert ?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss multi table insert ? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
vertigo
 
Posts: n/a

Default multi table insert ? - 02-15-2005 , 04:02 AM






Hello

INSERT INTO ALL WHEN DEPT_NO IN (12,14) THEN INTO EMP SELECT * FROM EMP_OLD;

Is it correct statemant ?
I think it's not (without first INTO it is ok), but i found somewhere
that it is.
Could anybody explain why ?


Thanx
Michal


Reply With Quote
  #2  
Old   
Malcolm Dew-Jones
 
Posts: n/a

Default Re: multi table insert ? - 02-15-2005 , 11:24 AM






vertigo (ax178 (AT) wp (DOT) pl) wrote:
: Hello

: INSERT INTO ALL WHEN DEPT_NO IN (12,14) THEN INTO EMP SELECT * FROM EMP_OLD;

: Is it correct statemant ?
: I think it's not (without first INTO it is ok), but i found somewhere
: that it is.
: Could anybody explain why ?


This is not valid Oracle PL/SQL, but it might be valid in some other
database system.



--

This space not for rent.

Reply With Quote
  #3  
Old   
Ed Prochak
 
Posts: n/a

Default Re: multi table insert ? - 02-15-2005 , 01:04 PM



No that is not a correct statement, because that INSERT... WHEN...
syntax is not Standard SQL. It is not ORACLE SQL syntax either. I have
no clue where you might find that it is valid. Are you sure it is not
pseudocode??

If you want that functionality, then consider using the ORACLE SQL
Loader. It is pretty good at loading data into multiple tables from the
same input stream.

HTH,
ed


Reply With Quote
  #4  
Old   
Anurag Varma
 
Posts: n/a

Default Re: multi table insert ? - 02-15-2005 , 01:26 PM




Well OP got it nearly right ....
The following cut paste from Ora 92 session should show it:

ORA92> select * from t2;

EMP_NO DEPT_NO
---------- ----------
1 10
2 10
3 10
4 11
5 11

ORA92> insert all
2 when dept_no in (10,12) then into t1
3 select * from t2;

3 rows created.

ORA92> select * from t1;

EMP_NO DEPT_NO
---------- ----------
1 10
2 10
3 10


Anurag


Reply With Quote
  #5  
Old   
Ed Prochak
 
Posts: n/a

Default Re: multi table insert ? - 02-17-2005 , 02:11 PM



Anurag,

I don't mind being corrected if I can learn something new.

Thanks
Ed

(I guess even my SQL reference is out of date. Well, when the standard
no longer changes, you know you are using a dead language. Obviously
SQL is not dead.)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.