Re: subqueries in inserts
Tobias Downer <[email protected]> Mon, 07 Mar 2005 16:26:41 -0800
| Newsgroups | gmane.comp.db.mckoi |
|---|---|
| Message-ID | <[email protected]> |
If the SELECT doesn't match any data then no data should be inserted into the table, and a result set with a single value of 0 will be returned. The original poster should remove the parenthesis. If removing the parenthesis causes a NULL exception, I'd be interested in seeing the full query and the layout of the table(s) so I may attempt to reproduce the error. Posting an SQL script that reproduces the error would be great. Toby. James wrote: > You can do insert selects with Mckoi. (Although I > don't think it is accurate to call the select a > 'sub-select') > > The proper form per Mckoi documentation is as follows: > > INSERT INTO table ( col1, col2, col3 ) > SELECT id, num, description > FROM table2 > WHERE description LIKE '11%' > > So you want to remove the parenthesis around the > select. > > Does the select return any rows? I suspect you get > the null exception because no rows are returned. > > Jim --------------------------------------------------------------- Mckoi SQL Database mailing list http://www.mckoi.com/database/ To unsubscribe, send a message to [email protected]