SELECT which returns the columns as DESCRIBED?

Hello

I need a SQL that returns the column name and type as DESCRIBED in SQL * more.

I know that I can query all_tab_columns, but then I concatenate the string type myself.

SELECT  column_name "Name"
       ,CASE WHEN data_type IN ('VARCHAR2','CHAR') THEN
            data_type||'('||data_length||')'
        WHEN data_type = 'FLOAT' THEN
            data_type||'('||data_precision||')'
        WHEN data_type = 'NUMBER' THEN
            CASE WHEN data_precision IS NULL THEN
                data_type
            WHEN data_scale = 0 THEN
                data_type||'('||data_precision||')'
            ELSE
                data_type||'('||data_precision||','||data_scale||')'
            END
        ELSE
            data_type
        END "Type"
FROM    all_tab_columns
WHERE   table_name = 'ABC'
ORDER BY column_id;

An idea for another solution that considers each default data type?

Concerning

Marcus

Tip: you can run a trace and see what SQL query rained questions on your account when you issue a describe statement.

That said, I do not know if all the of that formatting is in the request or if it is made by the executable SQL more himself.

Tags: Database

Similar Questions

  • SELECT which returns a minimum of time

    Hello

    I don't know how to do a select. I'm goig to explain what I want to see wheter can someone help.

    I have a select statement returns the columns following (table t):

    handle_id, logon_id, object_name
    ....
    ....

    I have another table with the following columns (table t0):
    time0, handle_id, logon_id, object_name, source, eventid
    ....
    ....

    If I make this selection:

    Select t0.time0, t0.source, t0.eventid
    t, t0
    where t.handle_id = t0.handle_id and t.logon_id = t0.logon_id and t.object_name = t0.object_name

    It returns me several records with the same State (handle_id, logon_id, object_name) because, of course, I said almost with the same conditions but with diferent time0.

    I want to have only one record for each condtion with the shortest time0.

    How can I do?

    I tried with separate, but it is not what I want.

    Thanks in advance.
    Kind regards.
    select  *
      from  (
             select  t0.time0, t0.source, t0.eventid........ , t0.accesses,
                     row_number() over(partition by t0.handle_id,t0.logon_id,t0.object_name order by t0.time0) rn
               from  t,
                     t0
               where t.handle_id = t0.handle_id
                 and t.logon_id = t0.logon_id
                 and t.object_name = t0.object_name
            )
      where rn = 1
    /
    

    If there may be several lines with 'shorter time0' for the same handle, logon_id, object_name, the above query returns olny one of these lines. If you want to get all these lines:

    select  *
      from  (
             select  t0.time0, t0.source, t0.eventid........ , t0.accesses,
                     dense_rank() over(partition by t0.handle_id,t0.logon_id,t0.object_name order by t0.time0) rn
               from  t,
                     t0
               where t.handle_id = t0.handle_id
                 and t.logon_id = t0.logon_id
                 and t.object_name = t0.object_name
            )
      where rn = 1
    /
    

    SY.

  • Calling a database procedure which returns the array as output parameters

    Hello


    I wanted to call a procedure that returns "T_Disponibilidad_Diaria".

    Type T_Disponibilidad_Diaria is Table of the R_Disponibilidad_Diaria
    INDEX OF DIRECTORY;


    Type R_Disponibilidad_Diaria is {Record

    }

    Please suggest me the best way to convert this type of array complex java object
    Thanks in advance


    Concerning
    Vidya

    But what you can do...

    Try to create a new stored procedure, which returns the type of the database object.
    In this procedure, you can call the original procedure.
    Take what it returns and make the type object. That's what you need to retrieve your procedure ;-) (.. .huh?)

  • In Oracle SQL, select cannot use the column in the statement and order of

    Hello

    Is there a work around for this.

    Thanks in advance
    Pablo.

    Hello

    943981 wrote:
    Hi all

    This is the error I get:

    ORA-00960: column ambiguous naming in select list
    00960 00000 - "ambiguous column naming in select list".
    * Cause: A column name in the order by list corresponds to more than a select
    columns in the list.
    * Action: Delete columns duplicated naming in the selection list.
    Error on line: column 6:17

    This error message seems pretty clear to me. What don't you understand?

    Or the other
    (a) use aliases, so each column has a unique name, or
    (b) remove the columns duplicated of the SELECT clause.

    Post your query. It is difficult to tell exactly what you're doing wrong when we do not know exactly what you are doing.
    For best results, view a complete test (including CREATE TABLE and INSERT statements) script, if necessary that people can to recreate the problem and test their ideas.
    See the FAQ forum {message identifier: = 9360002}

  • In Adobe send Web user interface, which is the column heading of the eye logo?

    In Adobe send Web UI, in files-> page of sent files, one of the columns has a look under the header logo. What exactly does it mean?

    Hi zoomarkup,

    This column displays history file (how many times a file was presented in preview). If you click on this column for a particular file, you will see who has seen or downloaded the file.

    Best,

    Sara

  • Simple HTTPService which returns the text

    I have made through Google and the documentation for it but still can't find what I want. Basically I have a php file that takes some of the entries, it treats and returns the text, I already know how to transfer the data to the flex php file, what I'm trying to do is get the text that returns the file and put it in a label in my flex application.

    So far, I have a function that the httpservice calls when the event "train", but so far, I still havn't found away to get the actual text that is returned, can someone tell me how to get this text the HTTPService?

    Just a note, I'm using the httpservice mxml form.

    The only thing is your text that is returned from php to be in xml format. Then, print your query result to XML first. And then parse through the xml in flex by using something like this:

    I created a script that analysis automatically any how MySql query that I throw at it as xml. There are some constraints you must follow while using it however.

    The caller script should have:
    $Query = a mysql query
    $queryName = 'name you give it. " This is also equal to the XMLRootName
    $tableName = 'name you give it. " This will correspond to the XMLResultSetName and doesn't really tell the table you are querying, but rather a generic name that you give the results table.
    $Result = mysql_query ($Query); the $Query is simply the veriable calling the actuall mysql query.
    include ('xmlParser.php'); place after the $Result statement.

    <-----------xmlParser.php------------>
    <>
    create the root node;
    $Return =""." \n"." \n » ;
    $Return. = «<$queryName>». » \n » ;

    treat a line at a time
    While ($row = {mysql_fetch_assoc ($Result))}

    Add node for each line
    $Return. = « <$tableName>». » \n » ;

    Add a child node for each field
    {foreach ($row as $fieldname-online $fieldvalue)

    $Return. = « <$fieldname>». "" $fieldvalue ". »«. » \n » ;

    } / / foreach

    $Return. = " «. » \n » ;
    } / / While

    $Return. = "«. » \n » ;

    ?>

    Then use the dataProvider to display resutls in Flex.

  • Select all of the columns in Table

    I'm doing a simple "SELECT * FROM TABLE". in a stored procedure, which of course turns out to be harder than I ever thought possible. I come from a background of MS SQL Server which I am comfortable with. But this PL/SQL...geez.

    I did some research on it, and from what I understand, I have to use a SLIDER for the results? Are you fricken kidding me! A few examples suggest to put the results 'IN' a variable. But that's a line I don't want.

    Example: I have my procedure... vcustomers is a point of view...

    CREATE OR REPLACE
    PROCEDURE USPGET_CUSTOMERS
    AS
    BEGIN

    SELECT * from vcustomers;


    END
    USPGET_CUSTOMERS;

    There is a small error in the test code above cela...

    CREATE OR REPLACE PROCEDURE uspget_customers)
    p_vcustomers_data ON sys_refcursor
    )
    AS
    BEGIN
    OPEN p_vcustomers_data
    FOR
    SELECT *.
    OF vcustomers;
    END;
    /

  • Return the column in the dynamic table based on indicators of control with the help of EL

    10.1.3 JDEV
    ADFBC
    The ADF faces

    I'm looking for EL that exposes if suspicion of display of the attribute has the value "Hide".

    Inside a < af:table > tag I dynamically generate columns from the View object:

    < af:forEach elements = "#{bindings." MyView.attributeDefs}.
    var = 'def' >
    < af:column headerText = "#{bindings." MyView.labels [def.name]} ".
    sortable = "true" sortProperty = "#{def.name} '"
    rendering = "true" >
    < af:outputText value = "#{row [def.name]}" / >
    < / af:column >
    < / af:forEach >

    I want to hide a column if the display for the corresponding attribute flag is set to 'Hide '.

    I was not able to find the appropriate EL syntax to expose this property.

    Does anyone know a quick/easy EL expression to expose the display flag?

    Thanks in advance.

    Looks like it will work only in 11g.

    Here's what you can do in 10.1.3.4 I tested as working...

    Add a bean support like this helper class (I registered with the managed bean name 'Helper' in the scope.

    package extendsproject.view;
    import java.util.HashMap;
    import java.util.Map;
    import javax.faces.context.FacesContext;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.jbo.AttributeDef;
    public class BackingBean {
      Map m = new HashMap() {
          public Object get(Object key) {
              if (key instanceof AttributeDef) {
                  AttributeDef ad = (AttributeDef)key;
                  DCBindingContainer bc = (DCBindingContainer)FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(BindingContext.RESERVED_BINDINGS);
                  if (bc != null) {
                      return !"Hide".equals(ad.getUIHelper().getDisplayHint(bc.getLocaleContext()));
                  }
              }
              return null;
          }
      };
      public Map getDisplayed() {
          return m;
      }
    }
    

    I have the reference in my dynamic page in the property 'made' column ike this:

              
                
                  
                    
                  
                
                
                  
                    
                  
                
              
    
  • Hide the values of the columns in the tables of the af

    Hi all

    I have a page with a table created using a basic VO EO af.

    I have a requirement where I need to hide the values in a particular column (see the empty value) for the given line when the value is greater than 100

    I tried the two expressions following groovy with failures. Can anyone suggest the phrase please correct groovy to achieve this

    Groovy expression Results
    #{row.bindings.JointAcNo.inputValue lt '100'}This hides values such as 2,3 as well (similar to a chain Treaty)
    #{row.bindings.JointAcNo.inputValue lt 100}

    crashes with the following error message

    Cannot convert the type oracle.jbo.domain.Number of class 0 class java.lang.Long

    ADF_FACES-60097: for more information, see the error log of the server for an entry beginning with: ADF_FACES - Exception during the PPR, #2 60096:Server



    JDev version - Studio Edition Version 11.1.2.0.0

    Hello

    The problem here is that the number 100 is java.lang.Long type and you compare it to #{row.bindings.JointAcNo.inputValue}, which returns the value of type oracle.jbo.number.

    To remedy this, you must convert 100 type oracle.jbo.Number. You can do this by writing a method in your bean managed as:

    oracle.jbo.domain.Number public getNumber() {}

    return new oracle.jbo.domain.Number (100);

    }

    Now, you can put your attribute visible/rendered as #{row.bindings.JointAcNo.inputValue lt yourscope.beanreference.number}

    The numer attriute in the beanreference automatically calls this value bean method and return of type oracle.jbo.Numer.

    Hope this helps,

    Assani

  • Display the column name of the column more recently updated

    I wonder if it is possible to display the name of the column in the column most recently updated in a table.

    Example:

    Emp table

    Name

    Height

    Weight

    Age

    Update_Date

    Update_Column

    Original record (03/20/14)

    Name size weight Age Update_date Update_Column

    John                                                 03/20/14          Name

    Then someone comes and update the height on 22/03/14:

    Name size weight Age Update_date Update_Column

    John 5'9 03/22/14 height

    And the Update_date and the Update_column would change again if someone came and put a value for the age. And so on.

    Is this possible?

    Also, if the above is possible, would it be possible to display the name of extreme right column if a user updated several columns at the same time?

    Example:

    User updates the sub-folder:

    Name size weight Age Update_date Update_Column

    John 5'9 03/22/14 height

    And adds weight and age at the same time on 24-03-14:

    Name size weight Age Update_date Update_Column

    John 5'9 150 31 03/24 / 14

    The Update_Column would display age because it is the furthest to the right. (Think by reading from left to right, the column that has been updated if the extreme right)

    So to sum things, I need to be able to display Updated_date (which will be the date of the day when the record is the last updated) and Updated_Col (which is the column name of the column was last updated, and if multiple columns are updated then display that value has been updated last in)

    I hope that the examples help to clarify things.

    Thank you

    Steven

    I think I found a solution.

    delimiter //
    create table a (
      id int (10) unsigned auto_increment,
      a int(10),
      b int(10),
      update_date datetime NULL,
      update_column varchar(16) NULL,
      primary key (id)
    )//

    create trigger bu_a before update on a for each row begin
      set NEW.update_date = NOW();
      set NEW.update_column = NULL;
      -- you need to start with the rightmost column if you want
      -- that matched with the highest priority
      if OLD.b != NEW.b then
       set NEW.update_column = "b";
      elseif OLD.a != NEW.a then
       set NEW.update_column = "a";
      end if;
    end //

    TEST

    insert into a (id,a,b) values (1,1,1), (2,1,1), (3,1,1), (4,1,1)[
    update a set b = 2 where id = 2;
    update a set a = 2 where id = 3;
    update a set a = 2 where id = 4;
    update a set b = 2 where id = 4;
    select * from a;

    DISPLAY

    ID  A   B   UPDATE_DATE                    UPDATE_COLUMN
    1   1   1   (null)                          (null)
    2   1   2   March, 24 2014 23:22:33+0000      b
    3   2   1   March, 24 2014 23:22:33+0000      a
    4   2   2   March, 24 2014 23:22:33+0000      b

  • How to list the columns for a view

    Dear experts

    I know how to list the columns in a table. This easy by querying the data USER_TAB_COLUMNS dictionary.

    But my problem is how to issue a query that returns the columns for a view?

    Thanks in advance

    USER_TAB_COLUMNS stores the metadata for both views.

    Select * from user_tab_columns where table_name = 'YOUR_VIEW_NAME"of order of column_id.    -Replace with your view_name (mandatory course)

    See you soon,.

    Manik.

  • sys_refcursor do not fetch any data, even if the query returns the value

    I use sys_refcursor to return the columns and aid below the procedure to do. Although the data are there in table_1 and table_2.

    PROCEDURE test_pro (abc_date N, DATE,
    cur_get_data ON sys_refcursor
    )

    OPEN cur_get_data
    for
    Select A.col1, B.col2
    from table_1 A
    where A.dis_date = abc_date
    left outer join
    table_2 B
    on
    A.dis_date = B.dis_date;

    IF cur_get_data % rowcount = 0
    then
    raise e_error;
    END if;

    EXCEPTION
    When e_error
    then
    -no_data_found;
    while others
    then
    -(giving an error with the SQL error code);

    END test_pro;


    When running under sql in the sql pl/sql developer window pick
    data
    Select A.col1, B.col2
    from table_1 A
    where A.dis_date = abc_date
    left outer join
    table_2 B
    on
    A.dis_date = B.dis_date;

    But while testing the test_pro in the test of the pl/sql Developer window, it is
    do not fetch all data and raise e_error every time

    is there a problem arising from the use IF cur_get_data % rowcount = 0 whenever that happens in the exception block.

    so can someone please put a few ideas what cud be the reason for this?
    PROCEDURE test_pro(abc_date IN DATE,
                       cur_get_data OUT sys_refcursor
                      ) is
    BEGIN
    
      OPEN cur_get_data for select A.col1,B.col2
                              from table_1 A
                             where A.dis_date = abc_date
                                   left outer join
                                   table_2 B
                                on A.dis_date = B.dis_date;
    
    /* while testing let exceptions just pop out
    EXCEPTION
    
      when no_data_found
      then
    ------no_data_found;
      when others
      then
    --------(giving SQL error with error code);
    */
    END test_pro;
    

    then you test as something like

    declare
    
      my_date   date := to_date('20120621','yyyymmdd');
      my_cursor sys_refcursor;
      col1      ... ;
      col2      ... ;
    
    begin
    
      test_pro(my_date,my_cursor);
    
      loop
    
        fetch my_cursor into col1,col2;
        exit when my_cursor%notfound;
        dbms_output.put_line(col1 || ' ~ ' || col2);
    
      end loop;
    
    end;
    

    Concerning

    Etbin

  • How can I take an anchored frame and return the paragraph tag used?

    I need to analyze through anchored frames and return the tag of paragraph that it is spotted. I can't find a property which returns the paragraph tag. Anyone have any ideas?

    Try this on the anchored frame selected:

    #target framemaker
    
    var doc = app.ActiveDoc;
    var aFrame = doc.FirstSelectedGraphicInDoc;
    var pgf = aFrame.TextLoc.obj;
    
    alert (pgf.Name);
    

    Rick

  • How to display a list of the columns (search bar - not displayed) in ascending order

    Hello

    I'll have an interactive report...
    In the Search bar we have to Select columns, unless we must do not display it.
    where all the columns (not shown) are listed.
    How can we display these columns in increasing order

    Thank you
    Deepak

    You want to display these columns in the IR?

    In the affirmative. Select the column you want to display, and then click on the the ' > '.
    In the interactive report regions - source, where you have your query to select columns use to rank them by order of the Association.

    You want to keep these columns as "do not display" and make them in the Association order it?
    Select all the columns to display and return the columns selections making "Not displayed" region order assn.
    Or in the query, select the columns in the desired order.

    I don't know if I'm helping. I fell like I got your question all wrong. Still...

    Published by: machan on December 11, 2009 11:01

  • convert the column values to a single line...

    I have to return the column values to a single line separated by commas.
    If the nulls in the column just ignore without a comma.
    Here is one for example. There are three values and two NULL values in the table
    SQL> select ID from temp_fa;
    ID
    -----
    
             1
             2
    
             3
    
             5
    
    6 rows selected.
    
    
    I am expecting an output as 1,2,3,5
    Help, please

    There is always more than one title in the Oracle world ;)
    You can use the TRIM, for example (same configuration as your example):

    hoek&XE>  create table t as select level col  from dual connect by level <= 6;
    
    Tabel is aangemaakt.
    
    hoek&XE> update t set col = null where col in (1,3,5);
    
    3 rijen zijn bijgewerkt.
    
    hoek&XE> select * from t;
    
           COL
    ----------
    
             2
    
             4
    
             6
    
    6 rijen zijn geselecteerd.
    
    hoek&XE> select ltrim(sys_connect_by_path(col, ','), ',') output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6,,,
    
    1 rij is geselecteerd.
    
    hoek&XE> select trim ( both ',' from sys_connect_by_path(col, ',')) output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6
    
    1 rij is geselecteerd.
    

Maybe you are looking for

  • Satellite S3000: How to change a component on the motherboard?

    How to open the case of this laptop? I need to change a component on the motherboard. I get to a point where all the screws on the base are off, and it seems that all that remains of access into the box for the "motherboard" motherboard is that perha

  • HP 250 G3: The brightness keys not setting

    Since I bought my new laptop 2 weeks ago, that I was not able to adjust the brightness of the screen of my laptop, it is at its maximum and the keys do not adjust it that I even tried to make adjustments but still it does not work. Please help the br

  • iMac suddenly running really slo

    Hello! I need assistance with my iMac, which is really slow suddenly. He now has trouble even during startup. I tried to use the activity monitor, to see if all the apps are used for the amount of ram, but no. Even when no programs are working it jus

  • Theme installs but not available as an Option

    I created a main theme for the Curve series.  The 8330, the installsfine theme and is available as an option in "themes."  He also appears in the list of applications.  On some newer models, it will install and appear in the list of installed applica

  • BlackBerry Smartphones Voice Mail password

    You want to add the voicemail password.  How do you do that?  I read to go to the phone icon, then voice mail icon.  Could not find either.  Have VZW 8130