dbTalk Databases Forums  

sql question: SELECT ... INTO

comp.databases comp.databases


Discuss sql question: SELECT ... INTO in the comp.databases forum.



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

Default sql question: SELECT ... INTO - 07-20-2004 , 08:20 PM






The SQL grammar given in O'Reilly's "lex & yacc" book requires that
SELECT statements include the 'INTO' clause:

SELECT foo, bar INTO :baz FROM noodle;

A very cursory look at the SQL standard leads me to believe that this
is correct -- that the INTO is a required element. However, it's
common to give queries of the sort

SELECT foo FROM bar;

or even

(SELECT foo FROM bar) UNION (SELECT baz FROM fraz);

Are these not valid SQL statements because they would return multiple
rows of data, or ... ?

Tobin

Reply With Quote
  #2  
Old   
--CELKO--
 
Posts: n/a

Default Re: sql question: SELECT ... INTO - 07-21-2004 , 09:54 AM






fricke (AT) gmail (DOT) com (tobin fricke) wrote in message news:<732840b1.0407201720.164ab8a1 (AT) posting (DOT) google.com>...
Quote:
The SQL grammar given in O'Reilly's "lex & yacc" book requires that
SELECT statements include the 'INTO' clause:

That is a singleton select statement and it is a special case of
embedded SQL. Get another book for details.


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

Default Re: sql question: SELECT ... INTO - 07-21-2004 , 12:13 PM



fricke (AT) gmail (DOT) com (tobin fricke) wrote in message news:<732840b1.0407201720.164ab8a1 (AT) posting (DOT) google.com>...
Quote:
The SQL grammar given in O'Reilly's "lex & yacc" book requires that
SELECT statements include the 'INTO' clause:

SELECT foo, bar INTO :baz FROM noodle;

A very cursory look at the SQL standard leads me to believe that this
is correct -- that the INTO is a required element. However, it's
common to give queries of the sort

SELECT foo FROM bar;

or even

(SELECT foo FROM bar) UNION (SELECT baz FROM fraz);

Are these not valid SQL statements because they would return multiple
rows of data, or ... ?

Tobin
I don't have a copy of the standard, just a summary reference. It
doesn't specify the INTO at all. So AFAIK the syntax is
SELECT <value expression> FROM...

and nothing in the section defining <value expression> mentions the
INTO clause. Perhaps your quick look only included the Embedded SQL
section? That's the only time I expect to use the INTO clause, ie in
embedding SQL in another language like C.

Joe should be along soon to straighten us out. meanwhile, I'd suggest
a closer look. Those database implementors can't ALL be wrong.

Ed


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.