Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / June 2006

Tip: Looking for answers? Try searching our database.

Parameter marker in Select

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Karun - 26 Jun 2006 11:57 GMT
Hello,
How do we convert the following Oracle query to DB2

INSERT INTO Table2 VALUES( (SELECT ?, Col1, Col2 FROM TABLE2))

The SELECT query could return multiple rows.

Thanks,
Anoop
Serge Rielau - 26 Jun 2006 16:20 GMT
> Hello,
>  How do we convert the following Oracle query to DB2
>
> INSERT INTO Table2 VALUES( (SELECT ?, Col1, Col2 FROM TABLE2))
First of all remove the VALUES, it's just wrong.
INSERT INTO Table2 SELECT ?, Col1, Col2 FROM TABLE2;
This may be sufficient. If it isn't this will work for sure:
INSERT INTO Table2 SELECT CAST(? AS <type>), Col1, Col2 FROM TABLE2;

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.