Get the types of columns in a select statement

Hello

Is there a way to get the types of columns that results in a select statement?

For example to force an analysis on this topic and then look for the types of columns resulting in the view v$?

Best regards

Klaus Mogensen

declare
  c       number;
  d       number;
  col_cnt integer;
  rec_tab dbms_sql.desc_tab;
  col_num number;
begin
  c := dbms_sql.open_cursor;
  dbms_sql.parse(c, 'select dummy, 33 x, sysdate now from dual', dbms_sql.native);
  dbms_sql.describe_columns(c, col_cnt, rec_tab);
  col_num := rec_tab.first;
  while col_num is not null
  loop
    dbms_output.put_line( rec_tab(col_num).col_name || ' ' ||
                          case rec_tab(col_num).col_type
                            when 1 then 'varchar2'
                            when 2 then 'number'
                            when 12 then 'date'
                            else '???? ' || rec_tab(col_num).col_type
                          end
                        );
    col_num := rec_tab.next(col_num);
  end loop;
  dbms_sql.close_cursor(c);
end;
/
DUMMY varchar2
X number
NOW date

Tags: Database

Similar Questions

  • Satellite L510 - PC Health Monitor - could not get the Type of Bios

    Hi guys,.

    I m appeal for some help and hope that some of you experts out there may be able to help me!

    My laptop is a Satellite L510 bought November 2009
    Windows 7 Home Premium SP1 32-bit
    The version of the BIOS/Date: INSYDE, 1.30, 08/05/2009

    Problems:
    1 ReelTime (worm: 1.0.04.0) TC00210100H stopped working about 6 months ago, so I uninstalled it.
    2 PC Health Monitor (worm: 1.4.0.0) TC00148300O

    Value Added Package: Worm: 1.2.25 (TC00214700E)

    For a couple of weeks stop would take a little longer than before and last weekend he just stopped even if the battery is fully charged.

    I had a bit of a job to resume but I finally did, I came to the conclusion even if the hard drive was not.

    I then tried to open the PC Health Monitor, but this error appeared impossible to get the type of bios and obviously wouldn t open. I uninstalled PCHM programs and features and then ran TC00148300O.exe of
    C:/Program Files / Toshiba / TOSAPINS / COMPS1 / TOSHIBA PC Health Monitor - 1.4.0.0, it seemed something was going on but ultimately nothing has.

    I dropped while I needed to sort first on the hard drive. Long story short, the hard drive has been replaced by a SSD 840 EVO 250 GB by a friend of TI at work.

    I prefer like to get ReelTime and PCHM working again correctly troubleshooting (with your help) that I put t really want to restore back provided that the factory, but if I have to...

    If I have explicit instructions on how to do that would be a big help (if necessary I can also get my friend to help me).

    If I n t give any other specific information that you need please ask. I apologize for this long post, but thanks to anyone who responds.

    Hello

    If you replaced the HARD drive I recommend you to install original recovery image and start using your machine with the factory settings. After that it all will again be OK. Install important Windows updates current, your important software and I think that everything will be OK again.

    Software related questions can sometimes be very complicated. All you can try to do is remove pre-installed application, restart the computer and try to install it again.

    On BIOS I can just say that you shouldn't change anything.

    One last thing: I don t know how important ReelTime and PC Health Monitor are for you, but I removed the two applications on my system. In my opinion there is no much help from both of them, but they CPU utilization for the unnecessary process.

  • Get the Type (U8, U16... I64) controls within a Cluster

    Hello

    I have a cluster with multiple controls.

    I would get the type of each control inside. To get the class is ok. It's simple and they are all digital. But I need to know if they are U8, U16, U32... I64.

    No idea how to do this?

    Paul

    I got it.

    I had to convert the Refernce element to digital, and then use the BitAccurateDataSize property.

    I lost several hours to find the solution and in 5 minutes after I had posted my problem on the forum I solved it .

  • How to get the type of network in Blackberry 10 Webworks 1.0

    Hello

    I am developing web applications and using connection plugin to get the type of network used.

    I've added the id of the required functionality in the file config.xml as follows:

    function id = "blackberry.connection".

    Now when you click on buuton, I call the function below:

    function currentConnectionType(){
        alert("1111111111");
        var connection = blackberry.connection;
        alert("222222"+blackberry.connection.CELL_3G);
    
        var connType = blackberry.connection.currentConnectionType();
    
        alert("Current con Type : "+connType);
    }
    

    In the code above curretCoonectionType is not called.

    Please help me correct where I am doing wrong. Or please let me know is there another way or sample code for the Type of network being used

    Thanks in advance

    It seems that the type property, you should get the current connection type:
    BlackBerry.Connection.type

    https://developer.BlackBerry.com/HTML5/APIs/gold/BlackBerry.connection.html#.type

    You can also save to connectionchange headphones to monitor changes in the type.

  • How can I get the type of coverage to work

    type of coverage

    How can I get the type of coverage to work

    Hi Ted,

    Once you take the type of coverage, it's ready to go!

    You are in a place to type in information?

    Once it is aligned, it works like a regular keyboard.

    B Eddie

  • When you use the Polygonal Lasso with 13 elements, I get the message 'no pixels are not selected to more than 50% ' why and how to remedy?

    When you use the Polygonal Lasso with 13 elements, I get the message ' WARNING: no pixel is selected to more than 50 percent. "  Why - and how to fix it?

    Make sure that the correct layer is selected.

    Decrease the amount of feathers.

  • How can I get the type of device in ESXi5?

    In ESX or ESXi4, use dmicode | grep 'product name'-i to get the type of device. But this command is not found in ESXi5. So, how can I get the type of device in ESXi5? Thank you.

    The dmicode | grep 'product name'-i train ESX4.1 as follows:

    [root@host22 ~]# dmidecode | grep -i "product name"
     Product Name: CN21UPSA  
     Product Name: CN21UPSA

    Try the simple way: "esxcli hardware platform get."

    / Rubeck

  • How to get the Type of a Collection class

    Hi all
    I just want to ask if there is a simple way to get the type of a Collection class.

    For example, for an ArrayList < String > or items of list < number > integer, dynamically how 'String' or 'Integer' class object (expecially with generic types) without any sequences of strange reflections?

    Thank you!

    Java generics follow one main erasure called which essentially States that any generic info is maintained during execution. If you can not, even if you can get information about variables and fields of reflection.

  • How to get the ddl of many paintings in a statement

    Hi all

    I have a scheme. It has 150 tables. I chose dbms_metadata.get_ddl ('TABLE', 'TABLE_NAME', 'SCHEMA') of double;
    It worked for me, but I have 150 paintings. There is a lot of time to do.

    Is there a faster way to do?

    Thank you!

    Dan.

    Duplicate - already replied to How to get the ddl from several tables in a statement

  • How to get the max of an element value selected iota AF Max.

    Hello community,

    Let me explain the scenario.

    We have a workbook of discoverer, who have several reports. These reports extract information from multiple views built specifically to retrieve information in several tables. So far, quite normal.

    Like any other report you can build these views, you can select the elements (columns) that you will use to create the report. Some of these elements (columns) are selected with the function MAX aggregate for this element; is that to say, instead of the profit of the item, and then click the SUM aggregation function, select the MAX aggregate function. With this option, we can get limit the number of search results.

    In our case, we have created a report that shows the items that we have in our stock, for each item, the report shows the sum of kilograms, the average price, its value (the sum of the average price x kilograms) for each element of the family, and we want the report to display for each item (remember that each element is a line in the report or folder) the largest number of transaction_id (of which there been selected using MAX aggregate function for the selected item), but a kind of transaction types.

    Let's see an example:

    Family | Product name | Sum of the kgs. | Units | Average price | Value of stock. Month | Year | Transaction ID | Type of transaction | Date of movement
    4420 | ALUMINA PS - M BB720 | 97.680,000 | KG | 44737 | 43.699,10 | 04. 10. 7740531 | Finalización Conjunto WIP | 16/12/2009
    4420 | ALUMINA PS - M BB720 | 47.760,000 | KG | 44737 | 21.366,39 | 04. 10. 8100110 | EXCESS | 31/03/2010
    4420 | ALUMINA PS - M BB720 | 97.680,000 | KG | 44737 | 43.699,10 | 04. 10. 8201603 | EXCESS | 30/04/2010

    Considerations:

    The value you see in the Transaction id is the maximum value that the field have; is that to say, each of the types of transactions, it shows the highest (last) transaction that id. looking at the example, the problem now is that we want to pocket the result a llitle little more. We want the report to show only from each product name or transaction id higher, either the date of circulation higher (as in the example above matches the transaction id 8201603 that have the highest movement 30/04/2010 - date).

    I stopped at that point because I don't see how to filter the data to get the result we want.

    Any suggestion or help would be appreciated, cause honestly, I don't see how.

    Thanks in advance.

    Luis.

    Hi Luis
    In order to get the last day of the month, given a year and month as strings, you will need to convert the strings to a date. Assuming you have a two-digit month and, presumably, a 2 digit, with the year 2000 year and more, then you need to start with a date and let's start with the first day of the month like this:

    To_date ('01' |: month: year, 'DDMMYY')

    You can use the ADD_MONTHS function to spend the month by one and then if you subtract 1 from that you will end up with the last day of the month.

    EndofMonth = ADD_MONTHS (TO_DATE ('01' |: month |: year, 'DDMMYY'), 1)-1

    You can also use the LAST_DAY function like this:

    EndofMonth = LAST_DAY (TO_DATE ('01' |: month |: year, 'DDMMYY'))

    Best wishes
    Michael

  • Value of the item as column name to select

    Hello

    I have a problem with the selection of the columns in the query using elements. For example: I have a request:
    Select column_a table; or select table column_b;

    and I want to do something like this:
    n ' any item where I choose the column name
    -query: select column_from_item from the tale of

    Is this possible?
    My version of the apex: 4.0.2.00.07
    My version of db oracle: oracle 11g

    Hello

    Create a report... type... as a function returning the SQL statement...

    and then you source should be something like

    declare
       my_sql_statement varchar2(1000);
    begin
       my_sql_statement := 'select ' || :p1_x || ' from table';
       return my_sql_statement;
    end;
    

    Kind regards
    Shijesh

  • Problem in configuring the type of columns in a table

    I have a problem with Labwindows 2009
    I want to put a table with two columns, each with a different type.
    I need a numeric column and a string column.
    The problem is that I can't configure each of the types in the Edit menu of the table.
    If I set the type of the first column in the Numeric form, this becomes automatically equal.
    Can someone help me?

    Support persons OR confirmed to me that I want to do in version 2009 cannot be done.
    The way to do it would be to create a column and set it with the desired type. Then delete and re-create and so on for each column that you need.

  • How to get the type of operating system

    Hi all

    How to get the Os type weather it wil 4.5 or 5.0 or etc... »

    can someone explain as a means of coding...

    Try the methods available in the DeviceInfo class.

  • How to get the value of column d/e with combinations of 3 columns?

    Hi all

    create the table dup_tab

    as

    Select 'AB100' donnees_1, data_2 ' 100 ', 'NN' data_3 data_4 ' 12345' double

    Union of all the

    Select 'AB100' donnees_1, data_2 ' 100 ', 'NN' data_3 data_4 ' 12346' double

    Union of all the

    Select 'AB100' donnees_1, data_2 ' 100 ', 'NN' data_3 data_4 ' 12347' double

    Union of all the

    Select 'AB200' donnees_1, data_2 ' 200 ', 'BB' data_3 data_4 ' 11111' double

    Union of all the

    Select donnees_1 'AB101', '101' data_2, data_3 'NB', '1234' double data_4

    Union of all the

    Select '1235' data_4, data_3 'NB', data_2 '101', 'AB101' donnees_1 double;

    I suspect the data as below, donnees_1,data_2,data_3 (a values) but d/f data_4 , I need to get these lines only please help me how to write a query on this

    DONNEES_1DATA_2DATA_3DATA_4
    AB100100NN12345
    AB100100NN12346
    AB100100NN12347
    AB200200BB11111
    AB101101NB.1234
    AB101101NB.1235

    In my table, I have to find with data of above combinations

    Given expected o/p

    DONNEES_1DATA_2DATA_3DATA_4
    AB100100NN12345
    AB100100NN12346
    AB100100NN12347

    Thank you

    Post edited by: Rajesh123 added extra test cases

    Hello

    Well, looking at the labels that you created for your question you have "Duplicate record".

    ...

    I suspect the data as below, donnees_1, data_2, data_3 (has the same values), but d/f data_4 , I need to get these lines only please help me how to write a query on this

    DONNEES_1 DATA_2 DATA_3 DATA_4
    AB100 100 NN 12345
    AB100 100 NN 12.4 K
    AB100 100 NN 12347
    AB200 200 BB 11111
    AB101 101 NB. 1234
    AB101 101 NB. 1235

    If you want to show the duplicated records, try the following:

    WITH t AS
      ( SELECT 'AB100' data_1, '100' data_2, 'NN' data_3 ,'12345' data_4 FROM dual
      UNION ALL
      SELECT 'AB100' data_1, '100' data_2, 'NN' data_3 ,'12346' data_4 FROM dual
      UNION ALL
      SELECT 'AB100' data_1, '100' data_2, 'NN' data_3 ,'12347' data_4 FROM dual
      UNION ALL
      SELECT 'AB200' data_1, '200' data_2, 'BB' data_3 ,'11111' data_4 FROM dual
      UNION ALL
      SELECT 'AB101' data_1, '101' data_2, 'NB' data_3 ,'1234' data_4 FROM dual
      UNION ALL
      SELECT 'AB101' data_1, '101' data_2, 'NB' data_3 ,'1235' data_4 FROM dual
      )
    SELECT *
    FROM
      (SELECT data_1,
        data_2,
        data_3,
        COUNT(*) over (partition BY data_1,data_2,data_3) cnt
      FROM t
      )
    WHERE cnt > 1
    
  • How to get the Type of connection to URL programmatically

    Hi all

    I created a new connection of type "URL" in jdeveloper 11g.
    I need to get the value of the URL of the connection programmatically.
    Someone knows how to do?

    I use jDeveloper 11.1.1.6 with webcenter framework.

    Hello

    have you tried

    Context ctx is ADFContext.getCurrent () .getConnectionsContext ();.
    Object urlConnectionObject = ctx.lookup ("connection name"); Check connections.xml for this

    Frank

Maybe you are looking for

  • I can't on Ebay. I can't access all of their features. Just to start

    When in my Ebay site under sell similar next to one of my articles, I'm supposed to be able to revise, change etc. to one of my ads and all of a sudden it doesn't work on FireFox. We work just fine and if I go back to Internet Explorer it works. What

  • Why not Yahoo/Firefox Toolbar update or Firefox Add-ons don't load not?

    There seems to be some glitches with Yahoo/Firefox toolbar new - it will not refresh and I have all the bookmarks stored there. "" Then after a couple hours of troubleshooting, I find as tools > Add-ons Manager "DON'T to LOAD NOT? I saw Yahoo Toolbar

  • Office Windows 7 HP 110 t

    I am considering buying the HP 110 t Windows 7 Desktop, but the specifications in the e-mail circular saying for a power supply it has an "External 90W AC adapter.  All references I found to this unit said that, but it's probably not good?  It is a u

  • DeskJet 9800 stops halwfay

    Kind regards! It's frustrating that there is no real solution from HP for the same problem (the same problem in many models). I use a deskjet 9800, win8.1pro 64-bit. The main use of this printer is for the DAO, and every time that you try to draw a m

  • How do I reinstall window Vista Home premium as I am unable to do recovery disk

    How to reinstall window Vista Home premium as I am unable to do recovery disk. When I run the PCRestore file in the Tools directory, it gives error when starting to make the bet into shape. It gives to tools/dp.sc access denied error. I buy the Dell