How to extract the names of columns in dynamic SQL

Hi all

Is it possible to extract all the names of columns in a dynamic query?

In my case according to the user selections that my query will get changed (number of the column, column name and tables that everything can vary).

So now, is it possible to retrieve all the column names of the dynamic query generated?

I am using Oracle 11g (11.2.0.4)

Thank you

Shaz

Re: Dynamic Extraction on dynamic Sql

Tags: Database

Similar Questions

  • How to reference the names of columns, if you use select *.

    Hello

    How to reference the names of columns to get out of the data, when you use select * and not aware of the column names (and number of columns) in advance.

    Even if I could get the column names in the other variables. I am new to CF so question may be stupid.

    getting column names: -.

    < cfquery datasource = "RTW_ORA" name = "cn" >
    SELECT COLUMN_NAME
    OF ALL_COL_COMMENTS
    WHERE TABLE_NAME = ' #meas #
    < / cfquery >

    obtain data: -.

    < cfquery datasource = "RTW_ORA" name = "cd" >
    SELECT *.
    To #meas #.
    < / cfquery >

    How do all the output data?

    Any help would be much appreciated!

    Thank you

    Tushar Saxena

    How to reference the names of columns to get out of the data, when you use select * and not aware of the column names (and number of columns) in advance.

    Even if I could get the column names in the other variables. I am new to CF so question may be stupid. getting column names: -.


    SELECT COLUMN_NAME
    OF ALL_COL_COMMENTS
    WHERE TABLE_NAME = ' #meas #

    obtain data: -.


    SELECT *.
    To #meas #.

    How do all the output data?

    Your question is not stupid. You can use the concept of a query requestand their properties cfquery attributes name and result.


    SELECT *.
    To #meas #.






    column names: #column_names #.

    number of columns: #no_of_columns #.



    SELECT #column_names #.
    FROM the cd



    A SQL query: #resQoQ.sql #.

    Query:


       
       
    #column #: #cd [column] [currentrow] #.
       


    T/t:


       
    #column #: #QoQ [column] [currentrow] #.
       


  • How to extract the names of file/URL of all files in a folder (in the same directory of site)?

    I am creating an online music player, simple Flash-based; the user clicks on a song in a DataGrid, and then he plays, simple. I displays the information of the song with the ID3 method in the class 'sound', but I don't want to hardcode all the songs in the ActionScript code, because I change them. I created a folder "tracks" in the directory of the site; How can I extract the names of the files in this folder without knowing how many there are by nature, and files without knowing the URL?

    Use PHP or another script server to read the contents of the folder and to deliver the names of files for Flash in the form of data (xml or txt).

  • How to extract the values of column aliases based on different column values?

    Hello gurus,

    I have a table with the following struture-
    "drop table T;
    create table T(Name, Symbol, Amount,dep) as select
    'Anderia', 'AA', 1050000,'HR' from dual union all select
    'Michael', 'ML',150000,'Sales' from DUAL union all select
    'Bill', 'BL', 1050000,'Finance' from dual union all select
    'Nancy', 'NY', 4000,'HR' from DUAL union all select
    'Anderia', 'AA',3000,'HR' from dual union all select
    'Michael', 'ML',1050000,'Sales' from DUAL union all select
    'Bill', 'BL', 1200000,'Finance' from DUAL union all select
    'Anderia', 'AA', 1200000,'HR' from DUAL union all select
    'Vish', 'VH', 1200000,'Marketing' from DUAL;"
    And try to find the values of the column as
    Name, symbol, dep, amount, % Total, Total $Cumm, rank but some additional as-columns

    Amount HR, % HRTotal, $HR Cumm Total,
    Finance amount, FinanceTotal %, $Finance Cumm Total
    Sales amount, a percentage of Total sales, $Sales Cumm Total.
    Amount marketing, MarketingTotal %, $Marketing Cumm Total

    then I use the following query to retrieve the name, the symbol, the dep, amount, % Total, Total $Cumm, rank columns.
    select name
         , decode(grouping(symbol), 0, symbol, 'Total') symbol
         , dep
         , sum(amount) amount
         , sum(per_total) "% Total"
         , decode(grouping(symbol), 0, max(Cum_per_total), null) "% Cumm Total"
         , decode(grouping(symbol), 0, max(rank), null) rank
      from (
              select name
                   , symbol
                , dep
                   , amount
                   , per_total 
                   , sum(per_total) over(order by rk) cum_per_total
                   , rank
                   , rk
                from (     
                        select name
                             , symbol
                    , dep
                             , sum(amount) amount
                             , round((sum(amount)/max(total_amount)) * 100,2) per_total
                             , dense_rank () over (order by sum(amount) desc) as rank
                             , row_number() over(order by sum(amount) desc) as rk
                          from (
                                 select name
                                      , symbol
                                      , amount
                          , dep
                                      , sum(amount) over() total_amount 
                                      , sum(amount) over () 
                                   from t
                               )
                         group 
                            by name, symbol, dep
                    )
            )
      group         
         by grouping sets((name, symbol, dep), ())
      order by rank, max(rk) nulls last
    But I want to extract the following columns so... How can I do?

    Amount HR, % HRTotal, $HR Cumm Total,
    Finance amount, FinanceTotal %, $Finance Cumm Total
    Sales amount, a percentage of Total sales, $Sales Cumm Total.
    Amount marketing, MarketingTotal %, $Marketing Cumm Total


    as I want that all records, then will the dep..do-specific I need to use the case here?
    Thanks for all your time and effort in advance

    If I understand your needs, you need pivot: SQL and PL/SQL FAQ

  • How to change the name of column in table effectively

    Hello

    I use JDev 11.1.1.4.0.

    My JSF page is done with 3 or 4 EOs, your and LOVs. However, one of the EO tables has changed its column name. The name change is important for the standard project.

    I remember having a lot of harm in changing a prior column name (I had to start over), so I would ask the experts take on how to do it without too much impact.

    This particular column is an OT, VO and lives as a field test on a JSF page.

    All comments or suggestions will be greatly appreciated.

    Thank you

    Bones Jones

    Indeed, the only thing you would have to change is the ColumnName of the object attribute specific entity (name of column of data in the attribute from entity dialog box). Now, if you used sync with databases... feature you will need to go through a full process of refactoring. In this case, use the menu refactor in JDeveloper. See if anything on this post can help you to: http://jdeveloperfaq.blogspot.com/2010/04/faq-20-how-to-refactor-adf-components.html

  • How to get the name of column datagrid in AS3?

    In AS2, we can get it to help

    myDataGird.columnNames

    How about AS3?

    the columns in your datagrid property will return an array of datagridcolumns.  the property of a datagridcolumn headerText is the name of the column:

    for (var i: int = 0; i<>

    trace (myDataGrid.Columns [i]. HeaderText);

    }

  • How to remove the names of columns in SQL-report

    What I want is only data, without no column name.

    COLUMN LDATE
    SELECT SYSDATE LDATE
    FROM DUAL;

    LDATE
    --------
    07.11.11

    This example does not work. There are still LDATE above column. Any idea?

    It's all in the SQL * more manual...

    SQL> set heading off
    SQL> select * from emp;
    
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    
    14 rows selected.
    
  • 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

  • How to extract the name of the day of the current date.

    Hi, I refer this link for my date formatting.

    I want my date like that;

    Wednesday, February 29, 2012 07:22: 25GMT

    noopesh wrote:

    Hi, I refer this link for my date formatting.

    I want my date like that;

    Wednesday, February 29, 2012 07:22: 25GMT

  • How to dynamically change the names of columns LOV

    Hello

    I use JDeveloper 11.1.1.4

    I have only one requirement, while I need to change the names of columns in the list of values dynamically.

    How can I achieve it.

    Please help me.

    Kind regards

    John.

    Hello

    > But I want to change the column names 'ID' and 'Name' dynamically.

    Based on what? Condition? If Yes, have you tried to set the text for the label as an expression? If not based on the condition, you can also expose the VO to Java Impl and need a way to get the attribute and change its label.

    Arun-

  • How to get the name constraintlist and column in a table?

    Hello


    can someone please tell me how to get the type of constraint, and it is imposed on the names of columns in a table.




    Thank you
    Nico

    Hello

    Use the two tables:

    select * from all_constraints
    
    select * from ALL_CONS_COLUMNS
    

    Sorry SY, you were faster than me...

    Published by: user11268895 on August 19, 2010 13:27

  • How to get the names of the table columns in the quick dashboard

    How to get the names of the table columns in the quick dashboard


    Thanks and greetings
    ------------------------
    Kishore P

    Make a prompt like:

    SELECT case when 1 = 0 then 'D0 time. " "" T02 by month name "other" 'D2 market' '. "" M04 region' ' the end 'Sample Sales' UNION ALL SELECT case when 1 = 0 then 'D0 Time. " "" T02 by month name ' else ' 'Time D0. "" T02 by month name ' ' the end 'Sample Sales.

    Put the name of column in single quotes.

    Make your rank as a function:
    Rank ('F1 income'. "" Recipes 1-01 (after all) "by @{pColumn} {'D0 time'. ({"" T05 annually name '})

    It works fine for me

    concerning

    John

    http://obiee101.blogspot.com

  • The ' organize bookmarks page has changed and the column that lists all bookmarks has shrunk and only the folder icons are visible - their names have disappeared and is not visible. " How to restore the names?

    Records on the page "organize bookmarks" show only icons - names of bookmarks disappeared. Impossible to tell what bookkmarks they are. How to restore the names that were once next icons?

    You can place the mouse pointer on the border between the left and right panes and drag the border with the left mouse button to the right to this wider left pane.

    If this does not work or stay after you restart Firefox, then see:

  • How to replace the name of the column with variable

    Hello

    I have a PLSQL problem please.

    I have a table like this:

    IDENT LIBL_1 MONT_1 LIBL_2 MONT_2 LIBL_3 MONT_3 LIBL_4 MONT_4

    1               A          10               B               10          C               30               VIDE          0

    2               A          30               C               12          VIDE          0                 VIDE          0

    3               B          11               C               41          D               63               E               15

    ...

    I have a code like this:

    DECLARE

    x number;

    varchar2 column (20);

    CURSOR c_DPLT_TT_ICARE_FILL IS

    SELECT IDENT,

    LIBL_1,

    MONT_1,

    LIBL_2,

    MONT_2,

    LIBL_3,

    MONT_3,

    LIBL_4,

    MONT_4

    FROM MyTable;

    --

    l_mylist c_mycursor % ROWTYPE;

    BEGIN

    FOR l_mylist in c_mycursor LOOP

    x: = 1;

    the following: = "LIBL_" | x;

    WHILE ((l_mylist.colonne <>'EMPTY') OR (x < = 4)) LOOP

    -CODE-

    ...

    -CODE-

    x: = x + 1;

    the following: = "LIBL_" | x;

    END LOOP;

    END LOOP;

    The thing I want to do is to replace the name of column LIBL_1, LIBL_2... with a variable like this: = "LIBL_1" then value: = l_mylist.colonne to get the value of the LIBL_1.

    I tried manyu command but I can't find the solution. I even try an immediate execution but it seems that the list of cursor is unknown in the statement immediately execute.

    Anyone has a solution please?

    Thank you very much.

    user6390927 wrote:

    Hello

    I have a PLSQL problem please.

    I have a table like this:

    IDENT LIBL_1 MONT_1 LIBL_2 MONT_2 LIBL_3 MONT_3 LIBL_4 MONT_4

    1               A          10               B               10          C               30               VIDE          0

    2               A          30               C               12          VIDE          0                 VIDE          0

    3               B          11               C               41          D               63               E               15

    ...

    I have a code like this:

    DECLARE

    x number;

    varchar2 column (20);

    result mytable.libl_1%type;

    CURSOR c_DPLT_TT_ICARE_FILL IS

    SELECT IDENT,

    LIBL_1,

    MONT_1,

    LIBL_2,

    MONT_2,

    LIBL_3,

    MONT_3,

    LIBL_4,

    MONT_4

    FROM MyTable;

    --

    l_mylist c_mycursor % ROWTYPE;

    BEGIN

    FOR l_mylist in c_mycursor LOOP

    x: = 1;

    the following: = "LIBL_" | x;

    run immediately 'select'. the following: ' from mytable where ident =: b ' as a result using l_mylist.ident;

    WHILE ((result <> 'EMPTY') OR (x)<= 4)="" )="">

    -CODE-

    ...

    -CODE-

    x: = x + 1;

    the following: = "LIBL_" | x;

    END LOOP;

    END LOOP;

    The thing I want to do is to replace the name of column LIBL_1, LIBL_2... with a variable like this: = "LIBL_1" then value: = l_mylist.colonne to get the value of the LIBL_1.

    I tried manyu command but I can't find the solution. I even try an immediate execution but it seems that the list of cursor is unknown in the statement immediately execute.

    Anyone has a solution please?

    Thank you very much.

    Asuming LIBL_x columns have the same type or a base at least type

    then the changes above can help you.

    In addition, you can write your cursor loop in a loop "for i in (select...)."

    you don't need to write that match the code, but it is cosmetic.

    See you soon

    Karlheinz

  • How to write information to complete file including the names of columns in the ftp adapter using the Ombudsman?

    Hi all

    I have a requirement like the reading of the data from the DB table and put it in a location of ftp server using mediator.also file in the ftp location must be in .csv format.

    I am able to get the data from the file in .csv format.

    But here, my requirement is I want the data from the file with the names of columns (i.e. header information).

    Can someone help me in this problem.

    Thanks in advance,

    Divya.

    Hello

    I am able to get the information to complete file with column names.

    I added a code in the ftpadapter xsd file.

    nxsd:version = "NXSD".

    nxsd:stream = "chars".

    nxsd: encoding = "US-ASCII".

    nxsd:hasHeader = 'true '.

    nxsd:headerLines = "1".

    nxsd:headerLinesTerminatedBy = "${eol}.

    nxsd:outboundHeader = "empno, ename, sal, location, status ${eol} '"

    By adding the code above, I'm able to get the full file header information.

    Thank you

Maybe you are looking for

  • cRIO-9068 &amp; OR-time

    I have the system test with a cRIO-9068, a cRIO-9024 (w / 9114 chassis) and an expansion chassis 9146.  None of them are even near being synchronized, and it's a bit frustrating. How can I synchronize the 9024 grid and the grid 9068?  I have NEITHER

  • Get the erro 0xc000005 code during installation of World of Warcraft

    I keep trying to install 2 WoW and get an error to the same installation point. I get an error 0xc000005 code and it says the files included in the report are Temp/fe01_accompat.txt.  I installed this game before but had a virus so I reformatted and

  • How to turn off the most recent list used to term & other apps

    were if you search the registry problem disable MRU in all applications, especially the run command on the start menu, but I would like to eliminate all the other apps as well I found several solutions including one that mentions comdlg32, others who

  • Update security for Windows (XP) maintains a failure.

    This has happened for months. KB976323 is the culprit. My Tech of lead may not understand how to get rid of this update. It drives me crazy and adds a lot of time in my day when I have to wait for the software to load and then fails. Thank you.

  • Recover all saved files and folders

    I just used Malwarebytes to remove the virus from Windows recovery, but I can't access one of the personal stuff on the hard drive as my music files, pictures, etc.. Any help out there?