Print the name of the column by using the query

Hello

I need to print the column name and the number of number of columns i.e. columns in the query below. Please suggest me how to print

SELECT
E.EMPNO,
E.ENAME,
D.DEPTNO
FROM EMP E,.
D DEP.
WHERE
E.DEPTNO = D.DEPTNO

Please suggest

Thank you
Sudhir

Re: get the title of column
http://saubbane.blogspot.com/2011/01/how-to-find-column-count-of-query.html
Re: writing data from table to file

Published by: Johan July 5, 2011 16:28

Tags: Database

Similar Questions

  • ADF: How to print the query and the query passed into the class executeQueryForCollection methof impl VO parameters.

    Hello

    Kindly let me know how to print the query, and the parameters passed to it? I tried with the params parameter in super.executeQueryForCollection (qc, params, noUserParams); but could not succeed.

    I need save the query and the parameters passed to it. Kindly help.

    Thanks in advance,

    Kalpana.

    Here you go

    Coding with Passion: Oracle ADF - Debug Mode object query with parameters

  • Best way to get different counts on the same column by using a query.

    Hello

    I try to get three different counts of the values for a specific ID on a table.  In other words, I have an Id if 1-123 and 20 records with that ID in this table, which have a value of 'Y' or 'n'.  I'm looking for the number of each of these values for every 20 rows, but also a number of total values of tag values using the function count in a single query.

    In this spirit, I would like to see a result set as follows.

    Example of result set:

    1-123 5 15 20

    I thought that I would be able to do this by using the following query below, but it didn't work and I get a ' error absent expression.  If anyone can provide guidance on my query below or any other way to reach my goal I would really appreciate it.

    Query:

    Select a.par_row_id,

    countOfTagsNo.TagsNo as 'Tags not selected. "

    countofTagsYes.TagsYes as 'Tags selected. "

    countOfTagsTotal.TotalTags as 'Total Tags'

    of siebel.s_src_xm.

    (select par_row_id, count (attrib_08)

    of siebel.s_src_xm

    where type = 'AOI Tags' and attrib_08 = 'n')

    countOfTagsNo,

    (select par_row_id, count (attrib_08)

    of siebel.s_src_xm

    When type = "AOI Tags' and attrib_08 = 'Y')

    countofTagsYes,

    (select par_row_id, count (attrib_08)

    of siebel.s_src_xm

    When type = 'AOI Tags' and (attrib_08 = 'Y' or attrib_08 = 'n'))

    countOfTagsTotal

    where a.par_row_id = countOfTagsNo.par_row_id and

    a.par_row_id = countofTagsYes.par_row_id and

    a.par_row_id = countOfTagsTotal.par_row_id

    A.par_row_id group;

    Thanks in advance.

    Chris

    Hi Chris,

    I'm not sure that's what you want but you had probably better counting with nested decode (or case):

    Select a.par_row_id,

    Count (case when type = 'AOI Tags' and attrib_08 = ' don't then 1 end) as "Tags not selected."

    Count (case when type = 'AOI Tags' and attrib_08 = 'Y' then 1 end) as "Tags selected."

    Count (case when type = 'AOI Tags' and (attrib_08 = 'Y' or attrib_08 = 'n') then 1 end) as 'Total Tags.

    of siebel.s_src_xm

    A.par_row_id group;

  • How can I print the www.lesormes.com view

    I use jdeveloper 11.1.2

    I have search form build by setting "variable bind" in my display object

    I did drag the fields of research of the "executeWithParams" tree in my data controller

    and the search button is the button "executeWithParams".

    I have a strange behavior, so I need to print the query run when I press the button "executeWithParams".

    How can I do

    check http://codingwithpassion.blogspot.com/2010/11/oracle-adf-write-view-object-query-with.html

  • Y at - it an option to print the names of columns?

    Hi developers out there!

    Problem:
    When I try to print the data in the table, the names of columns like "COL01', 'COL02' and so on.
    But initially, they have other names.
    Am I missing something?

    Best regards
    Ruslan.

    If you go to your report and click on the 'Report Attributes' tab. You will see all the names of your column headers. and a group of radio buttons at the top of the page. Select custom, and then change the names of your column headers.

    In addition, it seems that on your 'Definition of the region' tab in the Source box, you checked the option button "use generic column names (analysis of query runtime only). Try to select the other radio button "use query column names-specific query and validate.

    Good luck.

  • How to print the name of the .sql file in the same file using sqlplus

    Oracle 10g on Linux platform.

    I am trying to print the name of the .sql script file in this file, but could not. Here is the file:

    test. SQL
    select '&0' from dual;
    But instead of print, it is asked for the entry:
    SQL> @test.sql
    Enter value for 0: 
    Can any body give me a clue as how can I print the name of the file.

    A quick Google search and I found this...

    http://blog.tanelpoder.com/2007/12/26/sqlplus-is-my-second-home-part-5-reading-the-name-of-currently-executing-script/

    Content of a1.sql

    appinfo set to
    Select sys_context (' USERENV', 'MODULE' ') of double;

    He'll be back...
    SQL > @a1

    SYS_CONTEXT ('USERENV', 'MODULE')
    -------------------------------
    01 @ a1.sql

    James.

  • new to 4.02, no grid or column names in the query results

    It is a bit strange, I have SQL Developer 4.02 just installed, and I don't see grid or column names in the query results.  Don't see anything useful in tools > Preferences, what don't get me?

    The worksheet gives you a couple of different ways to run a query...

    1. instruction execute sheet icon toolbar (large green arrow, or Ctrl + Enter).

    This produces a results tab of the query with the data displayed in a grid.

    2. worksheet icon toolbar Execute the Script (the small tip of the green arrow on lined paper, or F5).

    This produces a tab out of the Script with the data displayed on the printer.

    If execution of the statement to Execute the Script, using some SQL * most orders will remove the column headers:

    1. set the position

    2. set the pagesize 0 (or 1 or 2).

    Pagesize and linesize default is - 1.  By default, the spreadsheet is free for formatting output script as he wishes.  If you have not changed these settings in the spreadsheet, then see if you point to a startup script in Tools > Preferences > Database > name of the connection startup script file

    Kind regards

    Gary

    SQL DeveloperTeam

  • How can I print my lists of distribution for later use if the drive breaks down?

    Had a problem with the hard drive on the new computer. Company reloaded hard drive. Lost all email addresses. Had to manually type in THE addresses again. Is there a way I can save my addresses to disk or print it out on paper for later use if I lose them again?

    Open the address book window.
    Select tools-export
    Select the type of file.
    The name of the file.
    Choose where to save it.

  • is it possible to print the name and the location on the page documents

    I would like to print the file names and locations of my documents Pages, as well as the text of the documents. used to do in Word all the time. can't find this print option across Pages.

    Apple has intentionally excluded any iota of features of Microsoft Word of Pages. Thus, it is not a clone of Word and does not use a Microsoft Print panel. You have no ability to assign printing header or footer fields in the print output from the OS X Print Panel.

  • HP LaserJet 5200tn: y at - it an option to print the ip address or the name of pc at the bottom of each page printed, sent by this pc

    y at - it an option to print the ip address or the name of pc at the bottom of each page printed, sent by this pc.

    I don't think that there is no easy way to do it.

    Alternatives can be:

    • Maybe insert the data required in the document source (before printing), using features (such as headers/trailers) supporrted by application of document source (for example, Word); drawbacks to this are not all applications supporting these inserts and (once inserted) what happens if the source document is copied to another work station?
  • I want to print the username in each page using the network printer. To identify which print this page.

    Print the computer name on each page using a network printing

    Dear all,
    Help on this issue. I want to print the username in each page using the network printer. To identify which print this page.

    As much as I know that you can't do this with every printed page, but you can use the separation pages (* .sep) and have this printed on a single page at the beginning of each print job.

    Tip: Put the separator page in the folder % WINDIR%\System32.

    See here: http://support.microsoft.com/kb/102712

    .Sep file is just a text document, the following prints only the user name:

    Name $LUser $N
    $E

    John

  • HP LaserJet P2050 Series PCL6: How to print the mark using PCL commands

    Our old system is printing of document using PCL commands, previously, only contanins text and barcode (using BARDimm), but we need now to print the mark registered with the name of the company, that the police should I use which has this symbol? Thank you.

    Assuming that your old system uses PCL5. You must first issue a set of symbol code that has a mapping to the registered symbol.  The Windows Latin 5 symbol set has the R symbol maps to chr (174) or (0xAE) said in

    Hex. The first publication of the code for the symbol set...

    (5 T

    and then the character itself

    0xAE

    Now that the characters cannot be entered directly on the keyboard, then you will need to find a way to integrate the character in your print workflow.

    Before the character himself is printed, you should choose a font. For most, if not all, printer fonts probably supports this defined symbol. For the test I used the arial font and it printed fine. The code for arial 12 pt would be...

    (s1p12v0s0b16602T

    Specify police, symbol set and finally the character. When you printed the character that you'll want to come back to the police in the use and the previous symbol set OR you can print the symbol as a secondary font. If you don't know how, ask here.

    I now have the idea how you would do this with PCL6. @dansdaduk can give you good (or bad) news on that.

  • How to print the name of the folder and its subfolder names

    I have a folder with miltiple sbu-records.  I need to print the name of the folder and related subfolders.  How can I do this?

    If you need it in a tree hierarchy, use this command:

    1 hold down the SHIFT key and right-click on the folder.
    2. click on command window open here.
    3. type the following command:
    TREE | Clip
    4. open your word processor, and then press CTRL + V
    This glue entries to the directory tree.
  • request to retrieve the value of the column and use in the other rows of the table

    Hi all

    I have a table where I maintain pairs name / value of a particular job.  Now, I would like to see some of the values of the rows passed to other rows in a table for example

    create job_name_value

    (

    VARCHAR2 (100) job_name,.

    name varchar2 (100),

    value varchar2 (100)

    );

    job_name name value
    TRGJOB% FPATH/ USR/LOCAL/TRGJOB
    TRGJOB% FDATECALDATE + 1
    TRGJOB$FNAME1%%FPATH.mywatchfile1.%FDATE
    TRGJOBFNAME2%%FPATH.mywathcfile2.%FDATE
    TRGJOB% FNAME3%FPATH.mywatchfile3.%FDATE

    can we write a sql query to produce output as below the objective is to use the value of fdate and fpath in the remaining lines. If there is no fdate and fpath then value should return such what or we need to use the stored procedure to achieve

    / usr/local/trgjob/mywatchfile1. CALDATE + 1

    / usr/local/trgjob/mywatchfile2. CALDATE + 1

    / usr/local/trgjob/mywatchfile3. CALDATE + 1

    Hello

    Since it cannot be '% FDATTE' or '% FPATH' (or both) then you need to replace each of them separately.  If the other does not, there 'replacement' will do nothing, but this will not affect the result of the other.

    Here's a way to do it:

    SELECT REPLACE (REPLACE (n.value

    '% FPATH.'

    p.value | '/'

    )

    , '% FDATE '.

    d.value

    ) AS output_value

    OF job_name_value n

    LEFT OUTER JOIN job_name_value p ON p.name = '% f '.

    LEFT OUTER JOIN job_name_value d ON p.name = '% FDATE '.

    WHERE n.name AS '\%FNAME%' ESCAPE ' \'

    ;

    I hope that answers your question.

    If this isn't the case, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.

    Report when the above query is to give erroneous results and explain, using specific examples, how to get the correct results of data provided in these places.  If you change the query at all, your postal code.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • How to view the line of columns without using the pivot keyword

    Hello
    could someone help me how to display lines in columns without using the keyword pivot and actuall is my scenario, iam having two tables with names and examples of data is shown below

    MIDDLE MINAME TASKID TASKNAME IDENTIFICATION PROJECT

    1 PROJ1 1 AA 100 PR1_TASK1
    1 PROJ1 3 CC PR1_TASK3 102
    1 PROJ1 DD 4 103 PR1_TASK4
    1 PROJ1 EE 5 104 PR1_TASK5
    1 PROJ1 6 105 FF PR1_TASK6
    2 PROJ2 EE 5 114 PR2_TASK1
    2 PROJ2 6 115 FF PR2_TASK2
    2 PROJ2 GG 7 116 PR2_TASK3
    2 PROJ2 HH 8 117 PR2_TASK4
    2 PROJ2 9 118 PR2_TASK5 JJ
    2 PROJ2 KK 10 119 PR2_TASK6
    2 PROJ2 1 AA PR2_TASK7 120


    The output should show the project and County of tasks at a given stage as shown below

    project AA BB CC DD EE FF GG HH JJ KK
    1 2 0 1 5 3 2 0 2 1 0
    2 1 2 0 2 1 0 2 4 3 1


    Thanks in advance,
    VVR
    CREATE TABLE pivot_test (
    ID           NUMBER,
    PROJECT      VARCHAR2(10),
    MID          NUMBER,
    MINAME       VARCHAR2(5),
    TASKID       NUMBER,
    TASKNAME     VARCHAR2(10)
    );
    
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 1,  'AA', 100, 'PR1_TASK1');
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 3,  'CC', 102, 'PR1_TASK3');
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 4,  'DD', 103, 'PR1_TASK4');
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 5,  'EE', 104, 'PR1_TASK5');
    INSERT INTO pivot_test VALUES (1, 'PROJ1', 6,  'FF', 105, 'PR1_TASK6');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 5,  'EE', 114, 'PR2_TASK1');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 6,  'FF', 115, 'PR2_TASK2');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 7,  'GG', 116, 'PR2_TASK3');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 8,  'HH', 117, 'PR2_TASK4');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 9,  'JJ', 118, 'PR2_TASK5');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 10, 'KK', 119, 'PR2_TASK6');
    INSERT INTO pivot_test VALUES (2, 'PROJ2', 1,  'AA', 120, 'PR2_TASK7');
    
    SELECT ID as PROJECT,
           SUM(DECODE(miname, 'AA', 1, 0)) AS AA,
           SUM(DECODE(miname, 'BB', 1, 0)) AS BB,
           SUM(DECODE(miname, 'CC', 1, 0)) AS CC,
           SUM(DECODE(miname, 'DD', 1, 0)) AS DD,
           SUM(DECODE(miname, 'EE', 1, 0)) AS EE,
           SUM(DECODE(miname, 'FF', 1, 0)) AS FF,
           SUM(DECODE(miname, 'GG', 1, 0)) AS GG,
           SUM(DECODE(miname, 'HH', 1, 0)) AS HH,
           SUM(DECODE(miname, 'JJ', 1, 0)) AS JJ,
           SUM(DECODE(miname, 'KK', 1, 0)) AS KK
    FROM   pivot_test
    GROUP BY ID;
    
    PROJECT AA BB CC DD EE FF GG HH JJ KK
    ------- -- -- -- -- -- -- -- -- -- --
          1  1  0  1  1  1  1  0  0  0  0
          2  1  0  0  0  1  1  1  1  1  1 
    

Maybe you are looking for