Home » SQL & PL/SQL » SQL & PL/SQL » star keyword oracle (Oracle 11g)
star keyword oracle [message #656740] Mon, 17 October 2016 07:30 Go to next message
ram_orafaq1989
Messages: 5
Registered: October 2016
Junior Member
Hi Team,
I was recently asked,what does the star keyword in Oracle does internally .
When i use it as select 5*2 from dual , it gives output as 10 but when i use it as select * from table , it gives the output of the table .
Please tell me how the star keyword is processed by oracle .
Re: star keyword oracle [message #656744 is a reply to message #656740] Mon, 17 October 2016 08:23 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Seems like you're answered your own question. If it's between 2 numbers it's assumed to mean multiply, if it's after the select key word then it means all columns. There isn't really anything else that can be said on the subject.
Re: star keyword oracle [message #656748 is a reply to message #656740] Mon, 17 October 2016 13:49 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9088
Registered: November 2002
Location: California, USA
Senior Member
As to the all columns, the following is an excerpt from the online documentation.

http://docs.oracle.com/database/121/SQLRF/statements_10002.htm#SQLRF01702

* (all-column wildcard)

Specify the all-column wildcard (asterisk) to select all columns, excluding pseudocolumns and INVISIBLE columns, from all tables, views, or materialized views listed in the FROM clause. The asterisk can be preceded with a table alias specified in the FROM clause of the same subquery. The columns are returned in the order indicated by the COLUMN_ID column of the *_TAB_COLUMNS data dictionary view for the table, view, or materialized view.
Re: star keyword oracle [message #656749 is a reply to message #656740] Mon, 17 October 2016 15:06 Go to previous message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
Your confusion apparently comes from thinking it is a "keyword" and therefore should behave as such.
No, it is not a keyword. It is just a single character and as you already see, it's usage/interpretation/whatever depends on how/where it is used. Just like a lot of other characters. In a lot of different products.

Think about how many different places you see other special characters that have different usages depending on context.
Previous Topic: replace with question mark in the filename
Next Topic: Help required for getting create index DDL on partitioned table.
Goto Forum:
  


Current Time: Fri Apr 19 17:58:29 CDT 2024