The number of columns in a query

All,

Could someone tell me please, how we can count the columns that were used in a query.

Ex: SELECT ENAME, EMPNO, SAL, USE of EMP;

-Here, in the query above, I took 4 columns (counted manually). Instead of counting it manually is there another way.

Thank you

Marty wrote:

Sorry knani, it'll work for ITO?  I can not test... I just wanted to know.

See you soon,.

Manik

You mean Index Organized Table? Of course it will check.

SQL > create table emp_iot
() 2
3 empno number,
4 ename varchar2 (6).
5 use varchar2 (9).
6 number of mgr,
7 hiredate date,
Number 8 sal,
9 number of com,
number of deptno 10,
11 (empno) constraint empno_pk_iot primary key
12)
Organization index 13;

Table created.

SQL > insert into emp_iot select * from emp;

11 rows created.

SQL > select column_value
2, to_number
3         (
4 xmlquery
5           (
6 content back "count($doc/descendant::*)" column_value as 'doc' passage
7           )
(8) - column_count 1
xmltable 9
10         (
11 ' / LINES/LINES "adoption dbms_xmlgen.getxmltype
12                            (
13 "select ename, empno, sal, emp_iot work.
14                            )
15         );

COLUMN_VALUE COLUMN_COUNT
-------------------------------------------------- ------------
SMITH 7369 1            4
2975
CLERK

ALLEN 7499 1            4
1600
SELLER

WARD 7521 11            4
250
SELLER

JONES 7566 1            4
2975
MANAGER

MARTIN 7654             4
11250
SELLER

BLAKE 7698 1            4
2850
MANAGER

CLARK 7782 1            4
2450
MANAGER

SCOTT 7788 1            4
3000
ANALYST

KING 7839 50            4
00
PRESIDENT

TURNER 7844             4
11500
SELLER

ADAMS 7876 1            4
1101
CLERK

11 selected lines.

SQL >

Tags: Database

Similar Questions

  • reduce the number of columns in the case query

    Hi all

    I'm running on 10 G R/2.

    I have a query that produces columns with the number of steps.

    SUM (CASE WHEN LTRIM (RTRIM (W_O)) = 'ROKOLBIN' THEN 1 ELSE 0 END) AS "O_ROKOLBIN."
    SUM (CASE WHEN LTRIM (RTRIM (W_I)) = 'ROKOLBIN' THEN 0 OTHERWISE 1 END) AS "I_ROKOLBIN."
    sum (case when LTRIM (RTRIM (W_O)) = "SYLVAIN", then 1 else 0 end) as "O_GULURU."
    sum (case when LTRIM (RTRIM (W_I)) = "SYLVAIN", then 1 else 0 end) as "I_GULURU."
    sum (case when LTRIM (RTRIM (W_ON)) = 'PURE' then 1 else 0 end) as "O_PURE."

    I want to reduce the number of columns to 2,

    A column is for Division.Division can be O_ROKOLBIN, I_ROKOLBIN, O_GULURU, I_GULURU, O_PURE
    The other column is Subtotal.Subtotal are the sums as above, SUM (CASE WHEN LTRIM (RTRIM (W_O)) = "ROKOLBIN", 1.)

    Can anyone advie how I acheiev it.

    Thank you.

    Hello

    CrackerJack wrote:
    ... Data are from Jan 12 to today, 1 million + records, that's why I'm unable to provide comprehensive data and simply copied an example of data.

    Nobody wants you to post 1 million rows. 10 lines can be many. Just examples of data make sure that validation really produces the results you post.
    >

    I copied data from 16 Jan just differentiate different dates.

    I also tried trunc, but who has still not the sum of each divisions.

    Highlight a few places where the query I posted produces erroneous results and explain how to get good results in these places. Give concrete examples showing how to get the correct results of the sample data.

  • Query the number of columns have data in a Collection

    Hello

    Apex 4.2.

    I use the EXCEL2COLLECTIONS plugin to import csv data into a collection.

    I am now validate the collection and would like to know the number of columns in the collection were given.

    For example, if my collection has less than 10 columns with data, then I want to generate an error

    Is there a way to do it

    Concerning

    Gus

    Gus C wrote:

    How and where is the best place to use this code.

    What type of validation

    You said:

    I am now validate the collection and would like to know the number of columns in the collection were given.

    and

    Otherwise, I should raise an error or enter an error indicator and the error message in columns 11 and 12

    So one could assume that aspect was already developed.

    The short answer is that without knowing the details of what you are trying to do, how your do it, and how you have reached: don't know.

    I expect this kind of import of data includes several pages forming a multi-step wizard, so there are a lot of possibilities. For example, use it in a cursor FOR loop to set the above error flag and message columns, then conditionally branch to a report with errors page if error indicators exist in the collection, or the next page of the wizard, if they are not.

  • The limit to the number of columns to display in the report. Help!

    Hi all

    Maybe this is a stupid question. But why get this error with a report of the IR? and what is the solution for this. Please help me with this.

    Error

    The limit to the number of columns to display in the report. Please, click on select columns under Actions menu to minimize the list of columns in report view.

    Oh... And I also have a blob column... If the format is not given, the table is very good... but happen to get this error only when the BLOB download format is given.

    Thanks and greetings
    John

    Published by: JB on March 30, 2012 11:08

    Hello

    I implemented a small suitcase of test on apex.oracle.com and I get the error even if I use the download format.

    I have a table
    test_blob (identification number, name varchar2 (10), blobcont blob)

    If I create IR as

      select
        id,
        name,
        blobcont
      from test_blob
    

    and then I set the download format I got the error.

    If you want this to work you need to change your query to

      select
        id,
        name,
        dbms_lob.getlength(blobcont) blobcont
      from test_blob
    

    And there still define download for blob on column blobcont format.

    Kind regards
    Aljaz

  • How to check the index, on the number of columns in the table is created

    How to check on the number of columns in the table the index has been created. ??

    OR

    How check index, on the number of columns in the table that it is been created?

    890306 wrote:
    How to check on the number of columns in the table the index has been created. ??

    >

    OR

    How check index, on the number of columns in the table that it is been created?

    query USER_IND_COLUMNS

    SQL> desc user_ind_columns
     Name                            Null?    Type
     ----------------------------------------- -------- ----------------------------
     INDEX_NAME                             VARCHAR2(30)
     TABLE_NAME                             VARCHAR2(30)
     COLUMN_NAME                             VARCHAR2(4000)
     COLUMN_POSITION                        NUMBER
     COLUMN_LENGTH                             NUMBER
     CHAR_LENGTH                             NUMBER
     DESCEND                             VARCHAR2(4)
    

    Handle: 890306
    Status level: Beginner
    Join date: October 8, 2011
    Messages total: 13
    Total Questions: 5 (5 open)

    Why all the question still pending?

    Published by: sb92075 on December 3, 2011 17:21

  • the number of columns in dynamic sql

    Hello

    I was wondering if you could count the number of columns had a dynamic sql code.

    Very simple eg.

    Say I had a string 'select 1, 2,3,4,5,6 double' and I only immediate excute. Is it possible to count the number of column IE 6 columns.

    I know s/n | THE USER | ALL_TAB_COLUMNS, but it could be a few different columns columns, and it is not a view.

    Thanks for you advice/help.

    with the "immediate execution" option you cannot get metadata such as the number of columns for the executed query. Use rather dbms_sql...

    Research of DESCRIBE_COLUMNS string in the link below... It will give you an idea of how to make to get the same.
    http://www.morganslibrary.org/reference/DBMS_SQL.html

    Ravi Kumar

    Published by: ravikumar.sv on July 30, 2010 15:51

  • Need to limit the number of columns

    When a tab in the last cell of the row, I want the cursor to the next line down. Instead, it creates a new useless column. Can't seem to find a setting that allows me to limit the number of columns in a page - someone ' one knows how to do this?

    Thanks for your wisdom shared, Oh wise Ones.

    I'm not aware of do what you want.  You can post your comments directly to Apple using the menu item "numbers > provide Feedback numbers.

    You can still use the key combinations:

    < command > + < right arrow > to access at the end of a line

    < command > + < left arrow > to move to the beginning of a line

    < command > + < down > to pass at the end of a column

    < command > + < arrow > to move to the beginning of a column

  • Display the icon change the number of columns

    I'm sure it must be a way to change the number of columns in the display icon, not the space between columns, not the size of the icons, but the number of columns, for example, that dumpster has 4 columns and I want to see those hidden on the right I have to use the scroll bar, I want to do I want to see ONLY for columns of the filling finder window?

    Thank you very much

    Roger

    "BTW that seems to only happen when I consult with ANY ' arrange by" or "sort by"!

  • How can I know the number of columns and lines on excel file

    How reading the number of columns and rows on an excel file after you open the file in excel with ActiveX.

    Using the example of excel200dem, I read that the file data is excellent.

    However, in this example, I just give the number of lines and columns.

    I want to know the number of lines and columns not giving those in C code automatically.

    Who knows this things? -?

    Help me please.

    Hello

    (1) this forum provides a search option, you must use in doing so, you will find this post

    (2) don't solve you your earlier questions? If so, you must mark responses that have helped you find a solution.

  • How can I know the number of columns in a TYPE?

    Hello

    If we have a guy like below

    type vc_arr2 is table of the varchar2 (32767) index directory.

    How can I get the number of columns?

    Minoo.TK wrote:

    Hello

    If we have a guy like below

    type vc_arr2 is table of the varchar2 (32767) index directory.

    How can I get the number of columns?

    It is a type of associative array definition. A table has no columns. It is a collection of elements (variables or values). An array location is usually called a cell.

    The standard method Count() exist in Oracle for all table types.

    As for the definition of the table, as in structures, variables make the table contain - associative array is defined in the PL/SQL code and does not exist in the layer of metadata to the database as a new user-defined type. For the definition, you must read the declaration of PL/SQL defining the table.

    Note that there is very rarely the need for associative tables in PL/SQL - 99% of the time they are used without any idea as to what as a table associative is also.

  • I need to convert PDF to Excel, however, the columns and tabs make many merged cells and the number of columns empty. In addition to not separate the columns properly, I see many not separate lines together in the same cell. I think same as Adobe Acrobat

    I need to convert PDF to Excel, however, the columns and tabs make many merged cells and the number of columns empty. In addition to not separate the columns properly, I see many not separate lines together in the same cell. I even think that Adobe Acrobat Pro DC has limits. There is no way to set what points in columns to force the column break? Or create several columns that are unnecessary? How column in Excel, size fixed when import us text and define where breaks have columns of text?

    Google Tradutor para empresas:Google para appsTradutor sitesGlobal market Finder traducao Toolkit

    Acts traducao Instantaneasobre o Google TradutorCelularComunidadePrivacidade e TermosAjudaEnviar comments

    PDF does not contain columns, lines, formats, styles or other aspects of word processing or spreadsheet file formats.

    This is because the PDF is decidedly not a file format of word processor or a spreadsheet or something 'like' one of these.

    (see ISO 32000 for what PDF "is")

    Which allows to optimize the export of the content of a page PDF is to start with that tag well formed PDF (ISO 14289-1, PDF/UA-1).

    Without that export is what it is and we performs the cleanup of any necessary content using the native application for the export of files (MS Word or Excel).

    Be well...

  • What is the purpose to define the number of columns?

    I have never used InDesign, so for Muse, I am confused as to the goal of being able to define the number of columns to be over 1-column?

    According my video tutorials Dani quickie review, I didn't see any action against the elements of design, she put on the page layout to "alignment on" an edge of column or not.

    Thanks for the tips.

    Using columns is part of a fundamental convention design layout design in a grid. A grid system can make the placement of your content more pleasant to the eye. Content that is simply eye-ball on a page can seem scattered, disorganized and obviously less appeal to viewers.

  • DR IP customizer: error on line number '17': the number of columns specified is incorrect.

    Hello

    I work with MRS 4.1 and trying to customizations ip configuration for my virtual machines guests on the recovering site (approx. 100 guests).  I've updated the CSV (generated from the order of Dr. - ip - customizer.exe) with all the necessary network information.  But when I try and upload it to my site SRM recovery server, I get the following error:

    Error on line number '17': the number of columns specified is incorrect.

    Is the command I use to download: Dr. - ip - customizer.exe - cfg... create csv - c:\srmip.csv - cmd \config\vmware-Dr.xml

    I found that if I change the csv file so that it contains 16 lines or less it downloads very well.  I have not read on any limitation of the number of rows in the csv file might contain so I think that there is a configuration that causes this behavior, but I can't figure out what that/where it is.  Any help would be greatly appreciated.

    Thank you.

    Hello

    something is wrong with your file formatting. A look at the image as an attachment. From the server6 (line 17) do not have the lines "," (comma) at the end of the line (and so less columns):

    If I take your file and then open in Excel and save it without changing anything, all lines have ',' (comma).

    Probably something wrong with the way in which you save the files (Excel throws several warnings when you try to save the file in the csv format, you have to press 'Yes').

    Michael.

  • How to count the number of columns in an oracle table using sql

    How to count the number of columns in an oracle table using sql

    You must put the name of the table in capital letters

    As

    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = 'EMP';
    
    or
    
    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = UPPER('Emp');
    

    Concerning
    Arun

  • Get the number of columns of textframe

    Is there a way to know the number of columns in a text block have?

    I can't find anything in the TextFrame class.

    Try this:

    var myColNum = app.selection[0].textFramePreferences.textColumnCount;
    

    --

    tomaxxi

    http://indisnip.WordPress.com/

Maybe you are looking for

  • Satellite P755 - cannot activate WLan using Fn + F8

    Hey I have a toshiba Satellite P755 and I don't know why, but my button WiFi by touch and pressing Fn + F8 doenst work more and I can't use WiFi now to enter the internet I tried to install the latest driver / wirless battery, display and others and

  • WRT610n &amp; Apple TV problems

    Hello Since I upgraded my WRT610n router to the latest firmware 1.00.03 B15 I'm unable to see the apple tv as a device in iTunes on any computer connected to the network (wired or wireless). I have apple TV on a multimedia network dedicated (only in

  • Cannot open 'manage offline files '.

    I'm creating on Windows 7 Home Premium offline files.When I press on "set up new sync partnerships, says"there are no new sync partnerships that can be installed on this computer", when I press 'Manage offline files', via aid or through the Sync Cent

  • Windows 7 crashes whenever a program is performing an action.

    Windows seems to hang (not answer) for 2-4 seconds every time that a program performs an action. Chrome, IE, Windows Explorer, VLC, Media Center, Media Player. If I run a program as an administrator, the computer hangs with a black screen before the

  • Default profile AnyConnect

    I use the latest version of AnyConnect (3.1.04072) on Win7. Everything works fine, except just now I connected to a new VPN server during a workout. Now, this URL is the profile that appears by default whenever I open AnyConnect. I wish the profile b