Hw to Get the number of table columns and their name in procedure ?

Friends,
I have to write some procedure. In this procedure, I want to get the total number of columns in a table. Also I want the column names for that table.
I have a requirement that I need to add column in the table dynamically in some cases. Later I want the name of that added column.
Thanks in advance,
Nirav

I want to get the total number of columns in a table. Also I want the column
names for that table
SQL> select column_name from user_tab_cols where table_name = 'EMP';
COLUMN_NAME
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
8 rows selected.
I have a requirement that I need to add column in the table dynamically in some
casesWhy ??
Rgds.

Similar Messages

  • Get the number of tables of a specific database

    Hy, I have to get the number of tables of a specific database. To do this, I connect to the database(mysql) and I get a Connection object.
    I do the next with this object:
    DatabaseMetaData dbmd=connection.getMetaData();
    ResultSet tables=dbmd.getTables(null, null, null, null);
    Now what to do to get the number of tables of the database?-
    Maybe counting the rows of this resultset I would get it
    because each table of the database is represented in one row of
    this ResulSet?
    Thank you!!

    Yes. Count them.

  • How do you restrict the number of table columns on the data tab?

    I have a table with 50+ columns. Is it possible to restrict the list of columns on the data tab to say 5 columns as I'm only interested in seeing/updateing the data for these 5 columns. You can restrict the number of rows using the filter but not the columns. Is there some other way seeing an updateable "view" of the table? I suppose you could create a number of views and edit through them but there are too many combinations.
    regards
    Paul P

    I don't know of any way of reducing the number of columns that display in the Table data grid.
    However, you can rearrange the columns to have the five columns you want to edit as the first five. With fifty columns, even this would be some effort to find and drag them to the left of the view, but it should give you the five columns you want to update on the window at the same time.

  • Is it possible to get the total value for column and assign to other field

    hi,
    Is it possible to get the total value of particular column and assign that value to another field?
    How to do this?
    Thanks in advance,
    SAN

    Afridi,
    My extended controller class code:
    package xxhr.oracle.apps.per.selfservice.appraisals.webui;
    import oracle.apps.fnd.framework.OAApplicationModule;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.OAViewObject;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
    import oracle.apps.per.selfservice.appraisals.webui.OverviewPageCO;
    import oracle.jbo.Row;
    public class XXOverviewPageCO extends OverviewPageCO {
    public XXOverviewPageCO() {
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if(pageContext.getParameter("XXCalcAvgButton")!=null){
    throw new OAException("welcome",OAException.INFORMATION);
    //getSum(pageContext, webBean);
    private String getSum(OAPageContext pageContext, OAWebBean webBean) {
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject ratvo = (OAViewObject)am.findViewObject("CompetenceElementsVO");
    OAViewObject valuevo = (OAViewObject)am.findViewObject("PerRatingLevelsVO");
    Integer Sum = new Integer("0");
    int numofRows = ratvo.getRowCount();
    for (int x = 0; x < numofRows; x++) {
    Object Rating =
    ratvo.getRowAtRangeIndex(x).getAttribute("ProficiencyLevelId");
    if(Rating!=null) {
    int numofRowsforvalue = valuevo.getRowCount();
    for(int i=0;i<numofRowsforvalue;i++){
    if(valuevo.getRowAtRangeIndex(i).getAttribute("RatingLevelId").equals(Rating)){
    Object StepValue=valuevo.getRowAtRangeIndex(i).getAttribute("StepValue");
    Sum = new Integer(StepValue.toString()) + Sum;
    OAMessageStyledTextBean displayCompAvg=(OAMessageStyledTextBean)webBean.findChildRecursive("XXCompAvgText");
    displayCompAvg.setValue(pageContext,Sum);
    return null;
    But it is not affecting in the page.
    Can you please tell me what is the problem.

  • How to get the values from table region and how to set

    Hi,
    I have a requirement as Seeded Page Having One Table Region having around 8 columns, In That Item Description field is there. My Requirement is I need add one more field for that Region and assign the value depending Item Description.
    I will create one new Item in that region and will give name as Item, But how to set the values to Item Depending on Item Description.
    Is it possible to through CO Extension, If yes..Pls help how to get it.
    Thanks in Advance,
    Hanimi

    Hi Hanimi,
    1. You need to extend the VO, add a new Attribute.
    2. In VORowImpl of the extended VO, you can find the getter for your new attribute (example getItem())
    3. In this getter method you can write some code like:
    if("ABC".equals(getItemDescription())
    return "XYZ" ;
    -Prince
    http://princekapoor82.blogspot.com

  • Hello in which transactions do i get the data for tables COSS and COSP

    Hello i have these two tables. i need to know which transactions correspond to them .thx

    Hi Antish,
    try with transactions KOAO & KOAP
    Thanks,
    Syf

  • Any table or program to get the number of records in P, A and F tables

    HI all
    any table for program to get the number of records in P, A and F tables. I want to create SQ01 queries to get the status of number of records. We are gng for a production cutover next week. Want to capture all the data before and after Upgrade cutover.
    Also suggest me how to create sq01 queries.
    Thanks in advance
    regards
    Janardhan KUmar K.

    Use Transaction LISTSCHEMA to see all the tables assosciated with ur cube
    Total number would be what you find in both the E & F fact tables. If there is no compression in the cube then E table will be empty.
    Alternatively u can use se16 transaction and enter E table and F table manually
    E table - /BIC/E(Cube name) and Ftable -  /BIC/F(Cube name)
    Or else u can go to the manage of the cube and without selecting any field for O/P and ticking the option output number of hits execute. The total of Row Count will give u the total no of records in the cube.

  • How to get the number of routes in MLS L3SW table with SNMP

    Hello experts,
    Is there any way to get the number of routes in the MLS-hardware Layer 3-switching table with SNMP, like with CLI command "show mls cef summary"?
    If possible, please let me know the OID and which MIB do I use.
    [e.g.]
    #show mls cef summary
    Total routes: 400000
    <omit>
    ====
    Device : C6509E
    IOS : s72033-advipservicesk9_wan-mz.122-33.SXH3a.bin
    ====
    Thank you,

    function buttonClick()
    var table = profileTable;
    var lnRow = table.rows.length;
    var insertedRow = table.insertRow(parseFloat(lnRow));
    var cell1 = insertedRow.insertCell();
    cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt"+></td></tr>";
    document.profileform.submit;
    on submit it goes to the second page, but the value i got using >>>System.out.println("row number from text >>>box"+request.getParameter("rowNum")); is null. What is wrong with >>>my coding. Can anyone solve this.HI carry
    Check the value of bold data
    function buttonClick()
    var table = profileTable;
    var lnRow = table.rows.length;
    var insertedRow = table.insertRow(parseFloat(lnRow));var cnt=inRow
    var cell1 = insertedRow.insertCell();
    cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt+"></td></tr>";
    document.profileform.submit;
    }try with it

  • How to get the number of columns in a result set???

    hi everyone..
    i am trying to establish a servlet applet communication....
    my applet send the sql query to the servlet as serialised string and then the servlet executes the query...
    Since i need to pass the result back to the applet, i thaught of passing the whole reult set to the applet..but that seems to be not possible..
    so i thaught of storing my result set data in a vector and then pass the vector,but the first problem that i came across is that how to get the number of colums in a result set....
    so is there a way to get the number of columns in a result set...???
    and also i would like to know if it possible to send my whole result set to the applet bye serialization or by any method...???
    thanx in advance

    You shouldn't do. It expenses resources (you should always close the ResultSet and the Statement as fast as possible). Simply gently process it into a Collection or Map of DTO's. Those are serializable.

  • How to get the number of decimal places configured for a site column

    Hi,
    I have a column 'SampleNumCol' of type Number, the number of decimal places to be displayed is configured as 2.
    The column conatins a value, but when retrieved programatically is displayed as 5.00000000  instead of 5.00.
    I am retrieving this column using listitem.Properties[field.InternalName].
    I need to trim the decimals based on  number of decimal places configured for the site column.
    How to get the number of decimal places configured for a site column?
    Thanks in advance,
    dhijit

    Get the field as SPFieldNumber and then check DisplayFormat which returns
    SPNumberFormatTypes
    SPFieldNumber numberField = list.Fields.GetFieldByInternalName("YourNumberFieldName") as SPFieldNumber;
    SPNumberFormatTypes numFormatType = numberField.DisplayFormat;

  • How to get the number of rows in a DB-Cursor

    When i open a database cursor i do not know how much rows are stored in the cursor. To solve this problem i have to send a 'select count(1) ...' to get the number of rows before i set up the cursor. I think that this is not very clever and could possibly cause performance problems. But i need the num of rows to show the percentage of processed rows. Is there any other way to get the num of rows? May be by checking the cursor directly?
    Please help!
    Thanx a lot

    In order to find out how may rows are going to be processed, oracle has to visit every row. So with a cursor, there is no property that will accurately reflect the number of rows until you get to the last one. That said, you could use
    select count(*) over() as row_count, <rest of your columns> FROM <your table>
    which will give you the total row count agaist each row in the result set. There are performance penalties involved but they will be less than issuing the query twice, once to get the count and once to get the rows.
    Have a look on asktom for some very usefull info about all this.
    HTH

  • How to get the number of rows written to the header of the spool file.

    Hi
    I need to create a header line for the spool file .
    the header line should include fixed length values .
    The header should include the number of records found in the table with a maximum begin date (begin_date is the column of the table)
    To get the header in the spool file , i wrote a select query has :-
    --SPOOL 'C:\Documents and Settings\abc\Desktop\output.TXT'
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
    rpad(' ',76,' ')
    from dad.school
    group by sysdate;
    SPOOL OFF
    which gets me all the rows in the table , but i only want the rows with the latest school_begin_date .
    how can i achieve that ...
    I know that a subquery should be written in the from clause to get the number of rows found with a maximum school_begin_date.
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
    rpad(' ',76,' ')
    from dad.school where
    select rownum from dad.school
    where school_begin_date = max(school_begin_date) ;
    the error i get is
    ORA-00934: group function is not allowed here
    I NEED HELP ..IN GETTING THE ROWNUM JUST FOR THE LATEST BEGIN_DATE ?
    PLS HELP ME IN WRITING THE QUERY .
    THANKS IN ADVANCE .

    Try this:
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000')||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) || rpad(' ',76,' ')
      from dad.school
    where school_begin_date = (select max(school_begin_date)
                                  from dad.school);

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

    Hello Everyone,
    This might be dumb question. But why do get this error with a IR report? and what is the solution for this. Please help me with this.
    Error
    The number of display columns in the report reached the limit. Please click Select Columns under Actions menu to minimize the report display column list.
    Oh.. And also i have a blob column.. if the format is not given, then the table is fine.. but happen to get this error only when the blob download format is given.
    Thanks and regards
    John
    Edited by: JB on Mar 30, 2012 11:08 AM

    Hi,
    i have set up a small test case on apex.oracle.com and I receive the same error if I use download format.
    I have a table
    test_blob (id number, name varchar2(10), blobcont blob)
    If I create IR like
      select
        id,
        name,
        blobcont
      from test_bloband then I define download format I hit the error.
    If you want this to work you have to change your query to
      select
        id,
        name,
        dbms_lob.getlength(blobcont) blobcont
      from test_blobAnd then again define download format for blob on blobcont column.
    Regards,
    Aljaz

  • The number of display columns in the report reached the limit" Interactive Report

    I get the error message of "The number of display columns in the report reached the limit" when trying to display less than 100 (100 is limit) columns when an aggregate has been created.   This does not happen when an aggregate has not been added to the IR report.  It seems to happen because I have a control break on as well.  When I turn off the control break it works but is not the result that we want.  Interesting enough, if I filter the results down to 500 rows it works just fine.  Does oracle treat aggregates as columns!?  This is a really odd issue that I really need to clear up.
    Oracle 11g
    apex 4.1.0.33
    Thanks in advance,
    Shawn.

    Hi,
    i have set up a small test case on apex.oracle.com and I receive the same error if I use download format.
    I have a table
    test_blob (id number, name varchar2(10), blobcont blob)
    If I create IR like
      select
        id,
        name,
        blobcont
      from test_bloband then I define download format I hit the error.
    If you want this to work you have to change your query to
      select
        id,
        name,
        dbms_lob.getlength(blobcont) blobcont
      from test_blobAnd then again define download format for blob on blobcont column.
    Regards,
    Aljaz

  • To restrict the number of data columns displayed in BW Web report

    Hi,
    In the corresponding Bex query i am using 'Start Time' characteristic in the row. In the BW Web template i don't want the 'Start Time' to be displayed when i execute.
    I tried to restrict the number of data columns displayed in the web item table properties but that did not help
    Can i get some help
    Thanks,
    Mala

    Hi Mala,
    You can try out the following: Create a view on your query and in that view remove the Start Time char from the drilldown. Use this view as a data provider in the web template.
    Hope this helps...

Maybe you are looking for