This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes Select 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Select 1" Watch "Select 1" New topic

Select 1

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1511
What does

do? What is its use ?

Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3456

This query creates a cursor which contains one column and as many rows as there are in the table. Value of that column is 1 in all rows.

This is not very useful construct.

I sometimes do use constants in the select clause in more complicated circumstances, eg:

(Note: the order by 2, 3 causes ordering by second and third column of the resultset. It is useful with union operator as there could be ambiguity in column names otherwise.)
I agree. Here's the link:
subject: Select 1
Similar Threads
MySQL equivalent to Oracle's "select * from dual;"
html text box issues
issue to pass the dynamic value in query
Strange JDBC PreparedStatements Problem
SQL Current Time