<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: why does &amp;quot;select 1 from dual&amp;quot; work - what is the &amp;quot;1&amp;quot;? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893250#M844532</link>
    <description>The syntax may not make sense on first look, but if you think about it... .&lt;BR /&gt;&lt;BR /&gt;1 is a literal. If you select 1 from emp; as scott/tiger, you'll see a bunch of 1's. It's similar to saying&lt;BR /&gt;&lt;BR /&gt;select 'Employee Name : '||ename from emp; The string is a literal and is echoed for each row. In this case, it allows you to pretty up a report. You need the single quotes so as not to imply that you mean a column name. Since a column name of 1 is not legal, sqlplus gives you a break and assumes that it is a literal. &lt;BR /&gt;&lt;BR /&gt;Hope that this helped&lt;BR /&gt;&lt;BR /&gt;Dual is, as many have pointed out, a convince table, It is handy for things like select sysdate from dual;</description>
    <pubDate>Wed, 30 Mar 2005 13:32:06 GMT</pubDate>
    <dc:creator>R. Allan Hicks</dc:creator>
    <dc:date>2005-03-30T13:32:06Z</dc:date>
    <item>
      <title>why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893240#M844522</link>
      <description>Okay, I've searched TFM, but can't find the SELECT explanation of *why* the syntax:&lt;BR /&gt;"select 1 from dual;" actually works.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.</description>
      <pubDate>Tue, 29 Mar 2005 13:36:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893240#M844522</guid>
      <dc:creator>abc_18</dc:creator>
      <dc:date>2005-03-29T13:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893241#M844523</link>
      <description>"dual" is a null object (think using /dev/null).  &lt;BR /&gt;&lt;BR /&gt;You generally use it to verify that you are connected to the database in scripts, and look for the error code.  Also, you can test to_char and to_date functions using the 'dual' object.  &lt;BR /&gt;&lt;BR /&gt;Not sure if that explains what you are looking for.  &lt;BR /&gt;&lt;BR /&gt;Brian</description>
      <pubDate>Tue, 29 Mar 2005 13:45:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893241#M844523</guid>
      <dc:creator>Brian Crabtree</dc:creator>
      <dc:date>2005-03-29T13:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893242#M844524</link>
      <description>Not quite what I was looking for.&lt;BR /&gt;&lt;BR /&gt;I'm trying to find what part of the "SELECT" syntax tree says using "1" is valid syntax...&lt;BR /&gt;&lt;BR /&gt;Also, I'm not sure how "dual" is supposed&lt;BR /&gt;to be /dev/null.  It looks just like an&lt;BR /&gt;ordinary table to me - are you saying&lt;BR /&gt;it's not?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Mar 2005 13:59:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893242#M844524</guid>
      <dc:creator>abc_18</dc:creator>
      <dc:date>2005-03-29T13:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893243#M844525</link>
      <description>Hi,&lt;BR /&gt;As I remember it.&lt;BR /&gt;&lt;BR /&gt;Yes, it is an ordinary table but, containing only one "post", containing the value "1".&lt;BR /&gt;&lt;BR /&gt;It is sometimes used like an "always true" statement in other languages.</description>
      <pubDate>Tue, 29 Mar 2005 14:41:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893243#M844525</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2005-03-29T14:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893244#M844526</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I think your are talking about select from dual in Oracle, correct?&lt;BR /&gt;In Oracle dual is a table made to help programmer to show an expression result instead of table contents.&lt;BR /&gt;For example, if you want to show time stamp, you can execute 'select sysdate from dual' and it will show you 'Mar-29-05'.&lt;BR /&gt;This table dual exists on sys objects and its contents is a column with 'x' value.&lt;BR /&gt;DonÂ´t change this, if you drop this contents, this 'select xxx from dual' will stop working.&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Tue, 29 Mar 2005 14:43:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893244#M844526</guid>
      <dc:creator>Julio Yamawaki</dc:creator>
      <dc:date>2005-03-29T14:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893245#M844527</link>
      <description>Dual is table that has 1 column and 1 row.&lt;BR /&gt;&lt;BR /&gt;1 is a 'literal' that will be returned by Oracle as it is from the Database.&lt;BR /&gt;&lt;BR /&gt;Basically, we use the Dual table to get something/anything from Oracle database once.&lt;BR /&gt;for example to get any expression evaluated or to have any calculation done by Oracle.&lt;BR /&gt;&lt;BR /&gt;You can similarly do a "select 1 from dept/any_other_table/view;" &lt;BR /&gt;&lt;BR /&gt;watch the result and you will get the idea.</description>
      <pubDate>Wed, 30 Mar 2005 00:47:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893245#M844527</guid>
      <dc:creator>Dilip Kumar_4</dc:creator>
      <dc:date>2005-03-30T00:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893246#M844528</link>
      <description>Hi abc,&lt;BR /&gt;&lt;BR /&gt;select 1 from any table will work as the syntax is correct. It comes from the expr option of the SELECT commnad.&lt;BR /&gt;&lt;BR /&gt;SELECT command selects column values from the tables/ views/ snapshots.&lt;BR /&gt;&lt;BR /&gt;SELECT also selects an expression (expr), usually based on column values, from tables/views/snapshotsâ ¦&lt;BR /&gt;&lt;BR /&gt;Where an expression (expr)is a combination of one or more values, operators or a column name. &lt;BR /&gt;&lt;BR /&gt;DUAL is a table ownerd by SYS that has 1 column called dummy of variable character length 1&lt;BR /&gt;&lt;BR /&gt;When you select an expression say 1 from a table (can be dual or any other table), it will return the expression depending on the number  of rows in the table.&lt;BR /&gt;&lt;BR /&gt;Eg:- Select  1 from dual;     returns 1 as there is only one record in dual.&lt;BR /&gt;       Select  1 from v$session;   returns 7 1â  s if there are 7 records on v$session&lt;BR /&gt;&lt;BR /&gt;Here is a table called TAB1 that has 3 rows.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select * from tab1;&lt;BR /&gt;&lt;BR /&gt;       ENO&lt;BR /&gt;----------&lt;BR /&gt;       101&lt;BR /&gt;       102&lt;BR /&gt;       103&lt;BR /&gt;Now if I select an expression say 1 from tab1&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select 1 from tab1;&lt;BR /&gt;&lt;BR /&gt;         1&lt;BR /&gt;----------&lt;BR /&gt;         1&lt;BR /&gt;         1&lt;BR /&gt;         1&lt;BR /&gt;&lt;BR /&gt;If I select an expression â  a+bâ    from tab1&lt;BR /&gt;SQL&amp;gt; select 'a+b' from tab1;&lt;BR /&gt;&lt;BR /&gt;'A+&lt;BR /&gt;---&lt;BR /&gt;a+b&lt;BR /&gt;a+b&lt;BR /&gt;a+b&lt;BR /&gt;&lt;BR /&gt;I hope this helps.&lt;BR /&gt;&lt;BR /&gt;Indi</description>
      <pubDate>Wed, 30 Mar 2005 00:58:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893246#M844528</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2005-03-30T00:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893247#M844529</link>
      <description>select 1 from dual statement will work as,&lt;BR /&gt;&lt;BR /&gt;[1]&lt;BR /&gt;1 .. will be printed for number of rows in that table dual.&lt;BR /&gt;&lt;BR /&gt;select will process(general) as,&lt;BR /&gt;&lt;BR /&gt;select &lt;SELECT expression=""&gt; from table;&lt;BR /&gt;&lt;BR /&gt;select expression may be table field name or arithmatic expression(s). &lt;BR /&gt;&lt;BR /&gt;Try as,&lt;BR /&gt;&lt;BR /&gt;select 1 + 1 from dual;&lt;BR /&gt;it will show as,&lt;BR /&gt;&lt;BR /&gt;1+1&lt;BR /&gt; 2 .. for all rows.&lt;BR /&gt;&lt;BR /&gt;I hope you got the point now.&lt;/SELECT&gt;</description>
      <pubDate>Wed, 30 Mar 2005 00:59:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893247#M844529</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-03-30T00:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893248#M844530</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;this is all explained in the documentation :&lt;BR /&gt;&lt;BR /&gt;"DUAL is a table automatically created by Oracle Database along with the data dictionary. DUAL is in the schema of the user SYS but is accessible by the name DUAL to all users. It has one column, DUMMY, defined to be VARCHAR2(1), and contains one row with a value X. Selecting from the DUAL table is useful for computing a constant expression with the SELECT statement. Because DUAL has only one row, the constant is returned only once. Alternatively, you can select a constant, pseudocolumn, or expression from any table, but the value will be returned as many times as there are rows in the table. Please refer to "SQL Functions " for many examples of selecting a constant value from DUAL."&lt;BR /&gt;&lt;BR /&gt;(SQL reference guide)&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Wed, 30 Mar 2005 05:38:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893248#M844530</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2005-03-30T05:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893249#M844531</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;about the dual.&lt;BR /&gt;&lt;BR /&gt;Dual is just a "convienence" table.  You do not need to use it, you can use anything you want.  The advantage to dual is the optimizer understands dual is a special one row, one column table -- when you use it in queries, it uses this knowledge when developing the plan.&lt;BR /&gt;&lt;BR /&gt;DUAL exists solely as a means to have a 1 row table we can reliably select from. &lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Wed, 30 Mar 2005 05:53:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893249#M844531</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2005-03-30T05:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893250#M844532</link>
      <description>The syntax may not make sense on first look, but if you think about it... .&lt;BR /&gt;&lt;BR /&gt;1 is a literal. If you select 1 from emp; as scott/tiger, you'll see a bunch of 1's. It's similar to saying&lt;BR /&gt;&lt;BR /&gt;select 'Employee Name : '||ename from emp; The string is a literal and is echoed for each row. In this case, it allows you to pretty up a report. You need the single quotes so as not to imply that you mean a column name. Since a column name of 1 is not legal, sqlplus gives you a break and assumes that it is a literal. &lt;BR /&gt;&lt;BR /&gt;Hope that this helped&lt;BR /&gt;&lt;BR /&gt;Dual is, as many have pointed out, a convince table, It is handy for things like select sysdate from dual;</description>
      <pubDate>Wed, 30 Mar 2005 13:32:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893250#M844532</guid>
      <dc:creator>R. Allan Hicks</dc:creator>
      <dc:date>2005-03-30T13:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: why does "select 1 from dual" work - what is the "1"?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893251#M844533</link>
      <description>.</description>
      <pubDate>Sat, 02 Apr 2005 02:22:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-quot-select-1-from-dual-quot-work-what-is-the-quot-1/m-p/4893251#M844533</guid>
      <dc:creator>abc_18</dc:creator>
      <dc:date>2005-04-02T02:22:49Z</dc:date>
    </item>
  </channel>
</rss>

