Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in SQL by (20.3k points)

I want to use oracle syntax to select only 1 row from table DUAL. For example, I want to execute this query:

SELECT user 

  FROM DUAL

...and it'd have, like, 40 records. But I need only one record. ...AND, I want to make it happen without a WHERE clause.

I need something in the table_name field such as:

SELECT FirstRow(user) 

  FROM DUAL

1 Answer

0 votes
by (40.7k points)

Try using ROWNUM like this:

SELECT user FROM Dual WHERE ROWNUM = 1

For detailed information, refer to this: http://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns009.htm

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
asked Jul 22, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...