Current Position:Home > Doubt in DUAL TABLE

Doubt in DUAL TABLE

Update:10-11Source: network consolidation
Advertisement
Hi,
below is one query
SQL> select * from dual;
D
XNow from the below Query I came to know that there is one field in the dual table DUMMY which is having VARCHAR2(1)
SQL> desc dual;
Name                                                  Null?    Type
DUMMY                                                          VARCHAR2(1)now my doubt is when I run the below query how it is displaying text more than 1 character
SQL> select 'how are you' from dual;
'HOWAREYOU'
how are youplease explain
thanks in advance.

The Best Answer

Advertisement
Hi,
What you are SELECTing here nas no relation to any column in the table.
There's nothing special about the dual table regarding literals. Try
SELECT  'Hello'
FROM    scott.dept;Notice that scott.dept does not have any 5-character columns, yet a query on scott.dept is producing a 5-character column.
When you query a table, you don't have to SELECT all of the columns in the table. In fact, you don't have to SELECT any of the columns in the table, as you demonstrated.
The query you posted, like the query above, does not refer to any columns in its base table; it's not surprising that the output doesn't resemble any column in the base table. In the case of the query above, which is based on a table that has 3 columns, the one column that we are SELECTing can't have the characteristics of all 3 columns in the table. Which column do you think the output should resemble, and why? 'Hello' is the first column of output; does that mean it has to resemble the first column in the table, which happens to be defined as NUMBER (2)? 'Hello' is also the last column of output; does that mean it has to resemble the last column of the table? 'Hello' is directly in the center of the output; does that mean it has to resemble the column that happens to be in the middle of the table? Of course not!
Once agian, it is perfectly legal, and sometimes extremely useful, to have columns in a result set that have no connection at all to any column in the table.
  • Doubt in DUAL TABLE Update:10-11

    Hi, below is one query SQL> select * from dual; D XNow from the below Query I came to know that there is one field in the dual table DUMMY which is having VARCHAR2(1) SQL> desc dual; Name                                                  Null?    Typ

  • How to return number range from sql (dual table) Update:10-11

    in sql plus I need to display values (numbers)1 to 52 from dual eg, 1 2 3 4 5 etc... Is this possible, can you display a range of numbers from an sql statment without creating atble holding the required numbers. I am trying to display 1 to 52 (week n

  • Select multiple rows from dual table Update:11-30

    Is it possible to select multiple rows from dual table using a single select statement. i.e., i want the out put to be column_name 1 2 3 4 Edited by: vidya.ramachandra on Dec 14, 2009 8:24 AMAside from the fact you're responding to an old thread... 1

  • DUAL Table problem Update:11-30

    As a quick way to grant privileges to almost all the objects in my schema to a role, i created a procedure (Courtesy of user CD from Oracle Forums). But when i executed the below mentioned procedure i got the error : ORA-01720: grant option does not

  • Sql query and dual table Update:11-30

    Hi, 1. Do dual table take any physical space in the database or it is only logically present? 2. Suppose a table contains 100 rows. Write a query to return 42,43,44 rows. Thanks, Mrinmoyuser3001930 wrote: Hi, 1. Do dual table take any physical space

  • How to generate multiple records on a single sql from dual table Update:11-30

    I wanted to generate ten sequence nos in a single sql statement from dual table. Is there any way to use that. I think somebody can help me on this by using level clauseI'm not 100% sure if I understand your requirement: Do you really want to use an

  • Use of addImageTheme method with dual table in query Update:11-30

    Is it possible to specify a query using the dual table that specifies a BLOB type? I'm trying to specify a image theme dynamically using the bean API. My image is a JPEG.Hi Jen, if you create a table with a BLOB to store the image, plus a geometry co

  • Silly question on dual table Update:11-30

    Hello gurus This dual table is a dummy table with varchar2(1)....my question is how it can select many psedocolumns from dual doesn't it exceed the allowed space of varchar2(1) Edited by: 964145 on Oct 9, 2012 5:35 PM> it cannot be a real table > No

  • Question on dual table.. Update:11-30

    after i insert another row into dual table, SQL*PLUS still returns only one row. But PL/SQL Developer returns 2 rows. What does SQL*PLUS do to return only one row no matter many rows exist in DUAL table?http://asktom.oracle.com/pls/ask/f?p=4950:8::::

  • Avoid Hard Parsing for executing dynamic SQL using DUAL table Oracle Update:11-30

    I want to know if dynamic sql statements involving DUAL table can be modified to remove HARD PARSING. We have several SQL statements are stored in configuration table, here is sample example -- query 1 before replacing index values as stored in confi