To get the name of the table the column

Hi I have an Html5 app, and I get the dataset from the database and bind the data based on the column name. but the answer of the oracle db column names as attr_1, attr_2 and so on. Here is the code and the result after execution.

create or replace PACKAGE SAYAM
IS
       CURSOR cur
       IS
              SELECT CAST(0 AS NUMBER(5, 0)) "COMPID" ,
                     CAST(0 AS NUMBER(4, 0)) "FINYEARID" ,
                     EMPLOYEEID,
                     CAST(0 AS NUMBER(5, 0))"MENUID" ,
                     CAST('' AS NVARCHAR2(10))"CALLBYPANEL",
                     EmployeeName
              FROM  EmployeeInfo;
             
Type cur_tbl
IS
       TABLE OF cur%rowtype;
      
END SAYAM;

DECLARE
       v_GlobalParam Xmltype:=Xmltype(
       '<QueryParam> 
<CompID>1</CompID> 
<FinYearID>1</FinYearID> 
<MenuID>0</MenuID> 
<EmployeeID>-1</EmployeeID> 
<CallByPanel>APPWEB</CallByPanel>
<EmployeeName>Ranjit</EmployeeName>
</QueryParam>'
       );
       tableglobal SAYAM.cur_tbl;
       rc sys_refcursor;
BEGIN
       SELECT XT.CompID,
              XT.FinYearID,
              XT.MenuID,
              XT.EmployeeID,
              XT.CallByPanel,
              XT.EmployeName bulk collect
       INTO   tableglobal
       FROM   XMLTABLE('/QueryParam' PASSING v_GlobalParam COLUMNS
              CompID NUMBER(5) PATH 'CompID' ,
              FinYearID NUMBER(4) PATH 'FinYearID' ,
              MenuID NUMBER(5) PATH 'MenuID' ,
              EmployeeID NUMBER(5) PATH 'EmployeeID' ,
              CallByPanel VARCHAR2(10) PATH 'CallByPanel',
              EmployeeName Varchar2(200) Path 'EmployeeName' ) XT;
       OPEN rc FOR SELECT * FROM TABLE(tableglobal);
       SYS.DBMS_SQL.RETURN_RESULT(rc);
END;


Now, I get the below result-

Capture.PNG

but the goal that is required is as below with the valid column name

Capture.PNG

Please let me know if there is any action to get the column names.

Thanks in advance.

Apologies - I have managed to reproduce the original problem in 12.1.0.2.

The problem with ATTR column names is that you use a local collection declared in a package.

You need a SQL type.

But does not change my position when it comes to a sensible direction to go.

SQL> l
  1  create or replace type sayam_obj as object
  2  (compid      number(5,0)
  3  ,finyearid    number(4,0)
  4  ,employeeid  number
  5  ,menuid      number(5,0)
  6  ,callbypanel  nvarchar2(10)
  7* ,employeename varchar2(100));
SQL> /

Type created.

SQL> create or replace type sayam_tbl as table of sayam_obj;
  2  /

Type created.

SQL> get test3.sql
  1    DECLARE
  2        v_GlobalParam Xmltype:=Xmltype(
  3        '
  4    1
  5    1
  6    0
  7    -1
  8    APPWEB
  9    Ranjit
10    '
11        );
12        tableglobal sayam_tbl := sayam_tbl();
13        rc sys_refcursor;
14    BEGIN
15        SELECT sayam_obj(XT.CompID,
16              XT.FinYearID,
17              XT.MenuID,
18              XT.EmployeeID,
19              XT.CallByPanel,
20              XT.EmployeeName) bulk collect
21        INTO  tableglobal
22        FROM  XMLTABLE('/QueryParam' PASSING v_GlobalParam COLUMNS
23              CompID NUMBER(5) PATH 'CompID' ,
24              FinYearID NUMBER(4) PATH 'FinYearID' ,
25              MenuID NUMBER(5) PATH 'MenuID' ,
26              EmployeeID NUMBER(5) PATH 'EmployeeID' ,
27              CallByPanel VARCHAR2(10) PATH 'CallByPanel',
28              EmployeeName Varchar2(200) Path 'EmployeeName' ) XT;
29        OPEN rc FOR SELECT * FROM TABLE(tableglobal);
30        SYS.DBMS_SQL.RETURN_RESULT(rc);
31*    END;
SQL> @test3.sql

PL/SQL procedure successfully completed.

ResultSet #1

    COMPID  FINYEARID EMPLOYEEID    MENUID CALLBYPANE
---------- ---------- ---------- ---------- ----------
EMPLOYEENAME
--------------------------------------------------------------------------------
    1        1          0    -1 APPWEB
Ranjit

Tags: Database

Similar Questions

  • How to get the column number

    Hi all,

    I'm sorry to ask this question because I found 2 different answers, tried without result. So before you go crazy, I prefer to ask!

    Thus given mySelection = app.selection [0], how is possible to get the column's selection?

    I tried app.selection [0] .parentTextFrames [0].characters.itemByRange (0, x)

    with x being app.selection [0] .index.

    but then I'm stuck as if I add ".textColumns", I get an error

    I explored the second way using app.selection [0].textColumns.item (1).insertionPoints.item (1), but once I'm stuck again.

    As a beginner I don't understand why there is no simple built-in function to call in order to obtain such a result of base

    Any help would be appreciated

    Thank you

    Ed

    Okay here goes,

    For and only for the linked text frames.

    // For and only for linked text frames.
    // Warning
    // The Good: This will PROBABLY work for you
    // The Bad :THIS IS A REALLY PRIMITIVE METHOD
    // The Ugly: It could fail in COUNTLESS cases
    // Here goes......
    
    var mySelection, textFrame, parentPage, c;
    mySelection = app.selection[0];
    textFrame = mySelection.parentTextFrames[0];
    parentPage = textFrame.parentPage;
    c = 0;
    while(textFrame && textFrame.parentPage === parentPage){
        textFrame = textFrame.previousTextFrame;
        c++;
    }
    
    alert('Column number: ' + c);
    

    Now with regard to the issue of the image columns bound text compared to the blocks of text with multiple columns of text or span. Depends on what you're trying to achieve with your workflow.

    The scripts are around written by me and others who convert multicolumn text executives to related texts related and vice versa.

    If you want to know which is more appropriate you can use with your workflow, then I suggest the regular ID forum.

    HTH

    Trevor

  • [ADF, JDev12.1.3] How to get the column headers, request of VO and VO bind vars used by an af:table?

    Hallo,

    I want to create a method that takes as a parameter the id of an af:table (used to display the search results) and returns:

    • the column headings of the af: table
    • Visible property (true/false) of the columns af:table
    • the actual query of the VO instance used to create the af: table
    • the values of real bind variables passed to the query of the instance of VO

    I would like to create a servlet which takes the parameters reruns the query and returns a report Excel/PDF file that contains exactly the same columns and same of the af records: table.

    I'm a little confused on who use the code to achieve this... you kindly help me?

    I did a similar qustion here Re: [ADF, JDev12.1.3] how to export an af:table to Excel in an ADF Essentials application? but then I guessed that it was preferable to create a new thread.

    Thank you

    Federico

    For this, you can use this type of code

    Context LocaleContext = _adfTableBinding.getLocaleContext ();

    for (attr AttributeDef: attributeDef) {}

    Label As String = attr.getUIHelper () .getLabel (context);

    _logger.info ("Attritbute name:" + attr.getName () + "column name:" + attr.getColumnName () + "Col4Query name:" + attr.getColumnNameForQuery () +)

    "Name:"+ label);

    }

    which produces this output

    Timo

  • How to get the column provided out of the Oracle Data Miner?

    Hi all!

    I use Oracle Data Miner provided with Oracle SQL Developer to predict the loss of customers. If I plan on the table column lets say X (as a target column) of table say T, so how can I get the corresponding values under my model?

    Here is the simplified model for the reference.

    Thanks in advance!

    Customer churn.PNG

    Hello

    Simply connect a node that accepts data to the node to apply it.

    For example, if you want to create a view or table table using the prediction of outputs generated by the node to apply it, and then add a Create Table node and connect the node to apply it.

    For more information, try the Oracle by example tutorials for ODMr.

    You must use the node apply Publisher to revise prediction outputs models to generate as well as the additional columns to include, for example columns id.

    There are a set of predictor columns added by default that may be acceptable.

    THX, mark

  • Get the columns returned by the query without running

    I have a table that stores SELECT queries in a column. I developed a .net application where the interesting thing for the user is what columns of the following SELECT statement returns. Currently, I load the sql as an OracleCommand object CommandText and fill a DataTable using an OracleDataAdapter object. I then read the names of the columns of the table filled. The data is not fully used. Requests can take up to 15 seconds to run. Because I do not used the data, I was hoping to eliminate the actual recovery of data and reduce the time needed to retrieve the records. Is it possible to analyze the statement for the colunm names with it makes the request for enforcement? Thank you.

    I imagine that there is a way you can search in the data dictionary, but you can also try to add 'WHERE 1 = 0' If you want the metadata.

    It will be useful,
    Greg

  • How to get the column headers into an Excel report with variable width columns?

    Hello:

    I read this question before but I can´t open the link when I try to download the solution I get the following: status HTTP 404 the requested resource is not available.

    Can someone help me with the solution? I want to just put a heading for each column (1 thermocouple, thermocouple 2, anemometer, etc.).

    In advance, thank you for your help!

    You may need to take some tutorials.

    LabVIEW Introduction course - 3 hours
    LabVIEW Introduction course - 6 hours

  • How can I get the columns-by-side?

    http://www.Adobe.com/devnet/Dreamweaver/articles/first_website_pt2_08.html

    In the creation of your first tutorial of Web site (see link) I can not understand how to recover the columns side by side are being stacked. I went on the indications of the tutorial at least five times. What I am doing wrong in coding?   Here is a picture of my screen:Dreamweaver.jpg

    Here is a screenshot of how the columns should be stacked (from the tutorial):

    Dreamweaver-1.jpg

    Take a look at where you graduate #center_column in the html code of the page. You have this:

    where it should be

    Because a class called 'center_column' has not been defined (somehow), it belongs to the following line.

    I saw your styles for all three columns, as IDs.

    Beth

  • Get the column names with cursor or an alternative

    Hi guys,.

    What I currently have is an email with an attachment from PL/SQL. I need to display the query results in .txt attachment. What I've done now is to use a slider but it shows only the results I want column names & ideally the message "14 rows returned. How could I put this in a VARCHAR2?

    Mike

    Add a value to each sub selection order by...

    for example

    SQL> set heading off
    SQL> ed
    Wrote file afiedt.buf
    
      1  select colA, colB, colC
      2  from (
      3        select 1 as ord, cast('TABLE_NAME' as char(30)) colA,cast('GRANTEE' as char(30)) colB,cast('PRIVILEGE' as char(30)) colC from dual
      4        union all
      5        SELECT 2, rpad('-',30, '--') colA, rpad('-',30, '--') colB, rpad('-',30, '--') colC from dual
      6        union all
      7        select 3, cast(table_name as char(30)) colA,cast(grantee as char(30)) colB,cast(privilege as char(30)) colC from user_tab_privs where table_name like 'EMP'
      8       )
      9* order by ord, colA
    SQL> /
    
    TABLE_NAME                     GRANTEE                        PRIVILEGE
    ------------------------------ ------------------------------ ------------------------------
    EMP                            SCOTT                          SELECT
    
    SQL>
    
  • How to get the columns of the table based on different conditions in one column?

    Hello

    I have two sql queries-

    Select sum (col1) sum1 Tab1
    where join_date > (sysdate - 1).

    Select sum (col1) sum2 of Tab1
    where join_date > (sysdate-4)

    I need to use a single query to get sum1 and sum2 data in a single line.


    Can someone help please how?

    Like this?
    
    select sum(case when join_date > (sysdate - 1) then col1 else null end) sum1
         , sum(col1) sum2
      from tab1
     where join_date > (sysdate - 4)
    
  • How to get the column and the row of winding of title in a custom section?

    In default, the title of column and line's not winding print when the specification in the Chinese environment.

    How to make them winding?

    Thank you

    Please change ExtendedAttributes$ xlate$ .xsl EASectionTable section of the file in the folder/reports/FO as below:

  • How to get the value of a particular column column name?

    Hi all

    How to get the column name for a particular column value.
    example:

    create table test (ID number, col2, col3 varchar varchar);

    Insert into test values (1, 'true', 'false');
    Insert into test values (2, 'false', 'true');
    commit;

    I want to choose the name of the data column 'true' with id = 1;

    That is to say) while waiting for answer is "col2". pls help someone.

    This might help:

    DECLARE
       c1 SYS_REFCURSOR;
    BEGIN
       OPEN c1 FOR
       SELECT col2,
              col3
       FROM   test
       WHERE  id = 1;
       --
       FOR c IN (SELECT rownum rn,
                        t2.column_value.getrootelement() name,
                        EXTRACTVALUE(t2.column_value, 'node()') value
                   FROM TABLE(XMLSEQUENCE(c1)) t,
                        TABLE(XMLSEQUENCE(EXTRACT(column_value, '/ROW/node()'))) t2)
       LOOP
          IF c.value = 'true' THEN
             DBMS_OUTPUT.PUT_LINE(c.name);
          END IF;
       END LOOP;
    END;
    
  • Get the name of the column in the Select row

    Hi guys,.

    I paint a picture in which there is commandlink in a line for each Column.When I click af:commadLink I want to get the name of the column on which commandLink is clicked.
    I tried to get currentRow Clicked from DCIteratorBinding but I want the column name or a column and index.

    Thank you
    Rahul

    Hello

    I added a tag of f: attribute for the command link, give it a name and provide the column name as value. In the ActionListener method, access you the link to actionEvent.getUIComponent (). Here call you getProperties or get attributes (one of the two exists) which returns a map. On the plan that you call get ("the f_attribute name") to get the column name

    Frank

  • Add/change the columns of data type (scripting)

    Hello

    I am writing a script to add default columns and their values in tables. So far, for me, it is possible to add columns to an existing table in the model.

    Then, I want to add value to the data type. I discovered there is a method called getDataType(). So far, I have not found the "setter; for this property.

    Like other scripts, I started by creating a table with columns, and then using the API to read the values.

    A simplified version of my code:

    get the columns of table

    myTab var = model.getTableSet () .getByName ("T_POSITIONS");

    colArray = myTab.getElementsCollection () .toArray ();

    loop through columns

    for (i = 0; i < colArray.length; i ++) {}

    the type of var data = colArray [i] .getDataType ();

    model.getAppView () .log (colArray [i] + "a datatype" + dataType);

    colArray [i] .setDataType ("VARCHAR2 (1)");

    }

    An error occurs when I want to run this script: could not find setDataType function in the object ID.

    I can't find the right method to add/change the datatype property.

    Any information would be appreciated.

    Hi Bart,.

    Here's what's in the column in the XML file:

    
    FDB11R21
    EMPLOYEES
    FIRST_NAME
    
    2015-01-13 12:45:08 UTC
    First name of the employee. A not null column.
    HR_870
    true
    false
    1
    LOGDT024
    20 BYTE
    false
    
    

    20 BYTES

    If you need set the size in "20 BYTE" or "20 CHAR".

    Philippe

  • How to change the width of the column guide itself?

    I make a brochure trifold and put in this way in the layout.  the space between the column (represented by the fine purple lines) guides is too narrow.  I want to make it wider.  I thought that this space was the 'gutter' but when I change the default of gutter. 25 "nothing changes on the page.  I expect the purple streaks ever further out.  am I adjust the wrong thing or what? Thank you!Picture 1.png

    The guides themselves aren't really doing anything. They are simply Visual that you as a developer can use or ignore. To get the column gutters to change you must go into "options of text block. Use the command-B (Mac) or control-B (PC) or right-click to access contextual menus and choose text block in a list options. Once the dialog box appears, you can change the gutters. If you want real gutters and guides to match, you must also change the guides. You can do this under the menu layout, «margins and guides»

    Hope that helps

  • How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    What is the formula?

    You can do this with a column of "index" in table 1, as this assistance:

    The formula in C2, filled to the bottom:

    IF (B =<>

    That increments a counter each time that it finds a negative number in column B.

    In the second table, you can retrieve a list of negative values in this way:

    The formula in A2, filled to the bottom:

    = INDEX (array 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0))

    It takes the line number, the formula is activated, subtracts 1 to the header line and look up the result in the column of table 1 C.  If it finds a match, it feeds the line number to the INDEX page with retrieves the value of the column of table 1A.

    To hide the red triangles of signage wrap the IFERROR formula, like this:

    = SIERREUR (INDEX (table 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0)),"")

    Of course, you can also simply filter on column B without the need to set up a column from another table or index.

    SG

Maybe you are looking for

  • password disappeared during migration

    I installed Mozilla on the new computer. Created a new profile. Copied all the files from my old computer to the new folder profile. After the launch of Mozilla a few splash screen displays who told me sth. on the conversion of profile. After complet

  • 7plus WiFi

    I recently bought 7plus Tablet and it conect WiFi great but when I turn it off and turn it back on I need to set the password for WiFi again.  My wife has the same kind of Tablet, but has not this problem isn't there something I can do. Thank you

  • Is it possible to open a file of Contacts (.abbu) in another application?

    Want to open my file of Contacts in a spreadsheet so that I can print labels. Is it possible to do?

  • No sound - unknown devices on Thinkpad T60 (with xp sp3, sp2 no)

    Hello! I have reinstalled xp on my T60 (sp3, sp2 no) and there are 2 unknown devices in Device Manager (1st: ACPI/TPM1200 2nd: HDAUDIO/FUNC). There is no sound on it. I tried the drivers on the internet and I read: atmel tpm for the 1st, audiodriver

  • having trouble setting up my printer

    last night a friend bought a HP Deskjet 1000. I don't have a usb cable and I am trying to plug it wireless. My computer is recognizing that there is a printer, but whenever I try to print something there is a mistake, and then I help out when he says